-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terraform claims the state's version is newer, when it's not #25918
Comments
Same issue is happening to me as well; tried deleting my local .terraform directory and running terraform init again. Error
Terraform version
remote statefile terraform version
|
Note that Are you able to look at the state file directly to check the version? For example, using the AWS S3 Console or the Terraform Cloud UI. |
Yeah I realized this after reading another issue regarding terraform state pull. However, when looking at my statefile directly in my S3 bucket (i.e Downloading and opening locally), it showed my terraform_version is "0.12.28". |
@alisdair Thanks. So after I raised this issue, I went ahead and tf v0.12.29 as the output of the plan stated, and all was fine and dandy. After reading your comment earlier, I wanted to compare the state from the s3 bucket with the output of
I got more curious, so I looked through the version history in the bucket to see what the state's version was before I ran apply with the newer version, and it had the version I think there's definitely something up. |
That sounds to me like Terraform is working as intended:
Once you upgrade to a new version of Terraform, the state file is also upgraded, and it can't safely be used with old versions of Terraform. I understand that this ratcheting of state file version is inconvenient. Combined with the confusion around My recommended solution in this case is to stick with version v0.12.29, or if that is not feasible, to roll back the state file to a backup if you have one available. |
No problem. I wasn't going to downgrade and planning to continue to use Anyway, I don't think this is working as designed. I understand the safeguards that have been put in place, and they make sense. But this is definitely falsely picked up as a version upgrade. As I mentioned, when looking at the s3 bucket version history to view the state from right before I used |
Can you expand on why you think that is the case? Maybe I'm misunderstanding something about your report. |
Not sure how related this is to everyone else, but I'm also seeing this. I think it's because i'm using a |
and can I ask how state files are updated, if I can see perfectly that in my S3 I can see that the file was not modified, and I put a previous version still with the same problem; this does not have any sense... I have the same problem from 0.12.8 to 0.13.2 but the statefile was in the S3 and it was NOT modified since months, so I do not understand where is recorded that I did some terraform init with another version... Can it be because it is accessing to data from other modules which were already with the version 0.13.2? |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
When running terraform plan/apply, terraform complains the state is using a newer version, but when looking at the version, it is pointed at the correct version.
Terraform Version
Terraform Configuration Files
Not really sure what would be relevant here. But happy to add whatever you need.
Debug Output
If possible I'd like to email an encrypted version. Please let me know.
Expected Behavior
Plan should work
Actual Behavior
Getting the error
Steps to Reproduce
terraform init
terraform apply
Additional Context
When looking the state directly, it is indeed pointed at
v0.12.20
References
This may be related to #23290
The text was updated successfully, but these errors were encountered: