Reputation: 53
my teammate is working with terraform v0.12.28,i started working with him but i was using v0.13.x and made some changes, we use state file which is stored in GCS bucket.
now my teammate asked me to downgrade as he has written some modules which are compatible with v0.12.28,i did downgrade my version but the remote state is still in v0.13.x.
now we are stuck with remote state having higher version. what is the safest way to fix this? we are in initial phase so we can destroy the whole infrastructure but still wanted to know a workaround for this.
Upvotes: 5
Views: 8702
Reputation: 3117
If you have versioning enabled in your backend bucket, I would suggest to
Unluckily this is a manual process and afaik there are no terraform commands supporting you in reverting the state to an earlier version.
For the future my suggestion would be:
e.g. by creating a versions.tf
:
terraform {
required_version = "0.12.28"
}
You can also pin provider verisons in there (e.g. if you need to stick with aws provider 2.x for any reason)
terraform {
required_version = "0.12.28"
required_providers {
aws = ">= 2.58, < 3.0"
}
}
Upvotes: 2