-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 State Snapshot Locked to 0.12.13 After Apply #23290
Comments
I'm also getting a And my scenario is even stranger... My terraform executable and state file are still on version
It also uses We are using P.S.: We are using tfenv to run different versions of terraform depending on what we are building. |
same issue here, we have teams in terraform collaboration, i don't want to be forced to upgrade my terraform version frequently just because someone use a newer version but actually there is no breaking change in tfstate between two versions. |
This happened again today.
$ terraform --version
Terraform v0.12.17
$ terraform state pull | grep terraform_version
"terraform_version": "0.12.17", |
This happens again today :( `terraform --version
|
In my case, I need to go remote state and update the version to 0.12.18 |
This happened to me today. I imported a resource from Kubernetes, which updated the state. State is kept in Terraform Cloud. |
In case anyone else needs it, I stumbled upon this in Terraform Cloud in
Changing this resolved my issue. Very inconvenient, but that's the solution. |
I had this same issue. In my case, I was running a tf plan for resource 'X' that clearly had the remote state version |
Same issue here. Getting a plan error for when the remote state version is greater than the state that uses it.
I use the same remote state in a terraform version |
Still happening on
With this issue, it makes remote state an absolute nightmare to manage. |
This bug needs to be fixed, causes huge amounts of hassle. Upgrading isn't always an option, and trying to aggressively force people down the upgrade path is wrong. People use the wrong version and the state is basically screwed, I've never seen an effective solution to this other than spending days digging into buckets to remove residual crap that terraform refuses to destroy by hand and start afresh. |
Still happening on
|
I have the same issue with Terraform 0.12.24. Error: This happens to me once an autoplan was triggered and failed and I run |
I have the same issue with 0.12.20 -> 0.12.24 |
It still occurring with |
Nice, this works perfectly. |
I'm just here to throw my voice into this apparent echo chamber of an issue. This is super annoying! Can this please get fixed somehow? |
This happens when more than 1 person is running tf apply and their terraform binary version is not the same. You may have terraform To fix this, you can open the terraform remote state (its basically a json) and update the value of terraform version to a specific version you want. Then make everyone on your team use the same version terraform binary using the link: https://releases.hashicorp.com/terraform/ To avoid this, you can also pin the version on your tf code as
|
Any workaround for this on Terraform Cloud? My Plan uses:
My TFC workspace State tab has no state: When I queue the plan I hit this: The issue occurred because the initial workspace run that used |
@dkirrane I had this exact version discrepancy. I think since the versions are so close, they are probably on the same version of tfstate json. For this reason, I pulled the tfstate from S3 (storing state remotely) and simply changed the {
"version": 4,
"terraform_version": "0.12.24",
"serial": 10,
... I think this is (very) ill-advised, but it seems to have done the trick for me 🤷♂️ . It's also reassuring that I was making this change in a non-production environment. |
Dear Hashicorp, Why is this tagged as If the rationale behind that "feature" is to prevent backwards-incompatible changes breaking the use of an older (patch!) version, then I'm sure you can do better than this. |
That is really poor advice and is a fundamental misunderstanding of what remote |
The behaviour is still the same with latest version :( :( Error refreshing state: state snapshot was created by Terraform v0.12.29, which is newer than current v0.12.28; upgrade to Terraform v0.12.29 or greater to work with this state |
The same problem... Error refreshing state: state snapshot was created by Terraform v0.12.29, which is newer than current v0.12.28; upgrade to Terraform v0.12.29 or greater to work with this state |
Same problem - I was able to fix this by going into the remote At first glance, a simple solution to this could be to expose a command like |
Running into the same issue as others. |
I had a similar issue when I accidentally pushed a 0.12 state with Terraform 0.13 in Terraform Cloud. That automatically set the version in the state to 0.13. I could not push an old state with 0.12 because it was older than 0.13. I was able to fix that problem via the method described here: https://support.hashicorp.com/hc/en-us/articles/360041299873 |
Still having the same problem between sub-versions 0.12.28 and 0.12.26. This needs to be handled gracefully.
|
Having same problem when trying 0.13, we have several individual environments (tfstate) and we use |
In a pretty 💩 situation right now. I created a new workspace and it automatically chose 0.14.0 on the very first plan. All the resourced showed this error.
Note that this was from the very first plan.
There is no state file for my workspace, so I don't even know what to revert at this point. Weirdest part is, I even deleted the workspace and recreated it. Set the version to 0.13.5 before running the first plan. And it still complains about the |
Yeah some weird errors here too with GCP provider and 0.14.0 hashicorp/terraform-provider-google#7945, but I cant downgrade... |
To clarify the issue I mentioned earlier, the workspace I was creating refers to outputs from another workspace which was mistakenly created with 0.14.0. So that's why even when I recreated my workspace with 0.13.5, it was showing the |
this issue still exists and is very annoying using
getting this error : while the same version 4 works for other resources in another tf-workspaces |
If it helps anyone else, I found an interesting corner case thats confusing due to the message displayed. I was in the process of upgrading some dependant terraform configurations (lambdas) and they use remote_state. I notice that I was getting this message , which I thought was part of the upgrade but it was in fact a chicken before the egg issue with remote_state because my current terraform version was trying to read remote state from an already upgraded version, it caused this error message , though to me it was not very clear thats where this was coming from |
Hit this issue today also However, the state version is 0.13.4, not updated since last december (s3 backend) ATM, I have to leave it as is or accept to recreate this part of my infrastructure (as there is lots of recreate needed...) If anyone has an idea where this snapshot version could come from or where is it located so I could change it manually, I'm very interested. |
@giom-l maybe (as @acidprime suggest) you have a data source |
I hit this issue too. One of the I was able to remove the reference to the data.terraform_remote_state and carry on. |
Same issues here. We use a remote GCS-backend for our state. Currently facing this issue:
|
Please fix this way-to-easy-to-trigger footgun. |
I have a similar issue, looking to help people who hit it. I'm using local execution (of course), and the fix, hear me out...
|
@mt-inside , |
@qwerty1979bg it still happening to me,
|
@lado936 I suspect that your case is not the same as the one described by mt-inside. This thread has been running for a while and people have mixed a few separate issues. If you are using Terraform Cloud, your best bet is to open a case with support, so they can help you with your particular error / issue: If you are using Terraform CLI, you can start a thread in the community: If you are sure this is actually related to the original poster's issue, please provide additional details. |
@qwerty1979bg its definitely Terraform CLI, i am referencing other module inside terraform which is in fact ran by terraform 0.14.6, i am using 0.13.6 and have the error showed up, as referenced module is ran by 0.14.6 i cant use it inside my module. |
Not sure if this is even a bug in my case, but I was also stuck with a shared remote state on 0.14, where my project was still on 0.12 and I had to migrate it to 0.13 first. As usual I did a plan using 0.13 locally, but before that instead of patching the remote state directly (on S3), I decided to pull it locally and patch my shared state source to use it as a local backend instead: data "terraform_remote_state" "shared" {
backend = "local"
config = {
path = "/home/.../${var.environment}.terraform.json"
}
} This is just a variation of some of the previous comments, but I found it safer to do this operation locally instead of patching the actual remote state that might as well be used by someone else in that moment. |
I have found working solution for Terraform Enterprise here: https://support.hashicorp.com/hc/en-us/articles/360041299873 Error was: |
+1 for adding a
|
Just hit this when going form 0.11.14 to 0.12.29. The error was
The issue was that the repo I was upgrading pulled in a 0.13.6 |
@yegorski Thank you for pointing that out. My 12.25 workspace is pulling |
I removed data "terraform_remote_state" block that was pulling TF state of a projects that's on a version higher than 0.12. This was a big project that was pulling in and referencing state from multiple other projects. |
I just ran into this on an upgrade from
|
Has anyone tried using I had a similar issue going from version |
The solution for me was to download a previous version of the state from s3 and re-upload it to replace the one with the wrong version |
I upgraded my terraform CLI from 0.12.9 to 0.12.13 while attempting to fix a problem unrelated to this bug report. In the process of dubugging this problem, I ran
terraform apply
unsuspecting that it would seemingly (for all intents and purposes) break my state in 0.12.9 forever.It turns out my problem was not solved by upgrading my CLI to 0.12.13 so I downgraded it back to 0.12.9. However, now in my Terraform project and all projects that pull in its state remotely I am experiencing this error on
plan
andapply
.Terraform Configuration Files
Expected Behavior
After upgrading to 0.12.13, on running
terraform apply
a prominent message is displayed warning me that continuing will upgrade my state and that it will be unusable in older versions of Terraform. Ideally, I would also have to provide some kind of flag or argument to bypass this warning so that I don't accidentally lock my state into this newer release.Alternatively, some kind of mechanism will exist allowing me to revert my state snapshot to a format that's compatible with the older release (0.12.9).
Actual Behavior
My Terraform project is now dependent on 0.12.13 so now all of my team members and I have to upgrade our CLIs and upgrade the CLI in our CI pipeline Docker image.
The text was updated successfully, but these errors were encountered: