Need to go back to lower version level of state

We are using v0.12.24. Was encountering errors and warnings and tried to fix by going to v0.12.31. Fixes didn’t work. Want to go back to v0.12.24 and start over agin.

Problem is that that state file on S3 is now at v0.12.31.

I’ve tried different commands and approaches found in doc. None successful.

The changes are not applied. All the work I’ve done is on local in a feature branch.

Question: How can I get the state file back to v0.12.24?

Error: Error loading state: state snapshot was created by Terraform v0.12.31, which is newer than current v0.12.24; upgrade to Terraform v0.12.31 or greater to work with this state

One of the commands I tried was terraform refresh.

Is it possible to return the state file to v0.12.24 so I can start all over again with efforts to fix the errors I was encountering?

What about deleting the state file that is stored in S3?

Hi @phillip-burger-sculp,

We recommend using versioned storage for the state, so in the s3 case you could restore the prior version of your state.

It’s hard to track any specific changes between state formats the older versions of terraform, but you can manually update the version and test that you can refresh and apply from the updated state as long as you keep track of any changes you may have made in the case of failure. If there was no backup, additional internal changes may need to be made in order to revert.

However, since there were no major changes across those versions other than bug fixes, and 0.12.31 is the only supported version for recent provider releases and further upgrades, I would suggest staying with the newer version if at all possible rather than reverting.


Thank you. I very much appreciate the response and the help that you provided.