1

As of a few months ago, Terraform will fail 10% of the time while, apparently, pushing state to the backend (which is in S3). I'll have to cleanup the cruft left behind, run it again, and it'll pass. It was working fine for a couple of years before this started. The provider version hasn't changed. The environment hasn't changed. Any thoughts on what might be causing/exacerbating this?

module.task-definition.aws_ecs_task_definition.task-definition-default: Destroying... [id=workflow-api-production]
module.task-definition.aws_ecs_task_definition.task-definition-default: Destruction complete after 0s
module.task-definition.aws_ecs_task_definition.task-definition-default: Creating...
module.task-definition.aws_ecs_task_definition.task-definition-default: Creation complete after 0s [id=workflow-api-production]
module.load-balancer.module.service.aws_ecs_service.default: Modifying... [id=arn:aws:ecs:us-east-1:326764833890:service/internal-webserver-ssl/production-workflow-api]
module.load-balancer.module.service.aws_ecs_service.default: Modifications complete after 1s [id=arn:aws:ecs:us-east-1:326764833890:service/internal-webserver-ssl/production-workflow-api]
╷
│ Error: Failed to save state
│ 
│ Error saving state: failed to upload state: operation error S3: PutObject, failed to rewind transport stream for retry, request stream is not seekable
╵
╷
│ Error: Failed to persist state to backend
│ 
│ The error shown above has prevented Terraform from writing the updated state to the configured backend. To allow for recovery, the state has been written to the file "errored.tfstate" in the
│ current working directory.
│ 
│ Running "terraform apply" again at this point will create a forked state, making it harder to recover.
│ 
│ To retry writing this state, use the following command:
│     terraform state push errored.tfstate
2
  • 1
    Are you using an old version of Terraform? There was an AWS SDK bug causing this error message that affected Terraform v1.6.0-v1.7.4, but v1.7.5 and later have an updated version that fixed this problem for some others who encountered it: github.com/hashicorp/terraform/issues/34528 Commented May 28 at 21:00
  • That must be it. I have 1.7.4 . Thanks for mentioning that. Commented May 29 at 1:04

1 Answer 1

0

This looks to be an AWS SDK issue that affected Terraform 1.7.4 (my current version). See comments.

Terraform suddenly, regularly fails while pushing state to S3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .