Problem
When using the terraform_remote_state data source to access a state file created by a newer version of Terraform, you may encounter the following error:
state snapshot was created by Terraform vX.X.X, which is newer than current vX.X.X; upgrade to Terraform vX.X.X or greater to work with this state
Cause
Older versions of the Terraform CLI enforced a strict version check on remote state files, preventing a newer state file from being read by an older version of Terraform. This check was removed in later patch releases to provide more flexibility.
This behavior was changed in Terraform versions 0.11.14, 0.12.30, 0.13.6, and 0.14.2. For more information, refer to the Terraform v0.12.30 changelog.
Solution
To resolve this issue, you must upgrade your local Terraform CLI to a version where this check is no longer enforced.
-
Check your current Terraform version.
$ terraform -v
- If your version is older than one of the patched versions listed in the Cause section for your corresponding major version, upgrade your Terraform installation to the latest available version.