docs icon indicating copy to clipboard operation
docs copied to clipboard

Terraform Crash File (errored.tfstate)

Open osterman opened this issue 6 years ago • 3 comments

what

  • Terraform can crash mid-apply. If this happens and your AWS session has expired, it might not be able to write to S3. The are other errors as well that may prevent Terraform from writing the updated state to the configured backend.
  • To allow for recovery, the state may be written to the file errored.tfstate in the current working directory.

remediation

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 to push it back to S3:

    terraform state push errored.tfstate

osterman avatar Jan 11 '19 06:01 osterman

I am facing the same. did you get any solution ?. can you help please ?

muthukumars avatar Jan 02 '20 07:01 muthukumars

+1

guru-cool avatar Aug 17 '20 11:08 guru-cool

@osterman do you know if errored.tfstate will be created if terraform is killed? I recently ran into something like this where terraform apply was running in Jenkins and Jenkins had a 60 minute timeout timer, so it terminated terraform uncleanly after 60 minutes and the state was never pushed to S3.

RothAndrew avatar Aug 17 '20 12:08 RothAndrew