Problem
When using a Terraform version older than v0.13.5 to read a state file created by a newer version, you may encounter the following error.
Error refreshing state: state snapshot was created by Terraform v0.13.5, which is newer than current v0.12.26;upgrade to Terraform v0.13.5 or greater to work with this state
This issue affects any version of Terraform prior to v0.13.5.
Cause
Terraform v0.13.6 introduced a more forward-compatible state file format. Versions prior to v0.13.5 cannot read this new format, leading to the error when you attempt to use a newer state file with an older Terraform binary.
State Compatibility Details
-
v0.13.6tov1.0.x: A state file created by Terraformv0.13.6or newer can be read by any higher version within this range. The state schema is stable, allowing you to switch between minor and patch versions in this range without state modifications. -
v0.14.0and Newer: Starting withv0.14.0, Terraform can read and write all compatible state files, even those from future minor versions of Terraform. This forward-compatibility for state files is designed to last until a new major state file format version is required.
Solution
To resolve this error, you must upgrade your local Terraform CLI to version v0.13.5 or greater to work with the state file.
Additional Information
- For more details on version changes, refer to the Terraform v0.14 Release Notes and the Terraform v1.1.0 Release Notes.
- For detailed instructions, consult the official Upgrading to Terraform v0.14 guide.