Reputation: 474
I was deploying using terraform through Jenkins Terraform v0.10.7. After a success deployment from my local machine using Terraform v0.11.1, I can not do it again from Jenkins, I have this error :
Terraform doesn't allow running any operations against a state
that was written by a future Terraform version. The state is
reporting it is written by Terraform '0.11.1'.
Upvotes: 4
Views: 6104
Reputation: 707
A colleague of mine, Manuel Sierra has bumped into this error and concluded with the following solution: (Be careful with the following, it is going to give version errors if you happen to downgrade to another version incompatible with the code)
In our case, downgrade from 0.11.14
to 0.11.13
yielded no errors.
terraform state pull > current.state
terraform state push current.state
Now you are good to go with the downgraded version.
Upvotes: 0
Reputation: 1102
If you are using TFE maybe you can re-queue the previous state created with 0.11.x. Or perhaps you can look in Jenkins history to get the last state created with 0.11.x.
Upvotes: 0
Reputation: 2683
$ terraform destroy
.tfstate
file$ terraform apply
Upvotes: 6