Problem
When performing a plan, an error is returned:
The current state of <resource address> was created by a newer provider version than is currently selected. Upgrade the <provider name> provider to work with this state.
Cause
This issue is caused when the state file was written by a version of the provider that has performed upgrades to a resource's internal schema. The resource's schema version is recorded in the state file and once a migration has occurred it can't be reverted without restoring a previous version of the state file. Older versions of the provider will fail to read a later version of a resource's schema.
Solution
Check if the providers used by the configuration have version constraints specified and that the same versions were used to write latest state file are being used when perform the plan operation.
You can check which providers were installed on the command line by running terraform version
.
If you are using Terraform 0.14+, make sure that you have the dependency lock file committed to VCS as this ensures that wherever terraform init
is performed, the same version of the providers will be used.
Outcome
If the issue persists after pinning the provider version, please reach out to HashiCorp support for additional assistance.