Terraform upgrade 0.13.6 to 0.14.6 not picking up

My main.tfstate file sits in aws s3 bucket. The main.tfstate version is reporting terraform_version = 0.13.6. When I run terraform v0.13.6 plan and apply everything looks good, no errors and no changes required. Then I try to upgrade to terraform v0.14.6 and I run terraform init; terraform plan; terraform apply. Also no errors and no changes reported. But when I look at the main.tfstate file I see that the version is still reporting 0.13.6. I ran this across multiple different code deployments and some upgraded successfully and reporting 0.14.6 while others did not upgrade and still reporting 0.13.6, using same upgrade procedure

   {
  "version": 4,
  "terraform_version": "0.13.6",
  "serial": 6,
  "lineage": "9733d965-d4c8-4ef7-6c82-ca37078b35c2",
  "outputs": {
    "acl": {
      "value": "private",
      "type": "string"
    },

Was there any resolution for this? I am seeing the same issues. I’m guessing it’s because nothing is actually being changed in the statefile. I want to know if this will cause any issues in upgrading in the future, as my resources that wont upgrade to 0.14 may not be changed for a long time.

Nope, nobody provided a solution. I am still experiencing same problem…

I’m facing the same issue utilising an Azure Storage account for my backend, I have a around 300 deployments that I upgraded to 0.13.6 (from 0.12.28) without experiencing this issue. During the upgrade to 0.14.6, I noticed that 99% of these weren’t updating the state file (but oddly the occasional one would). I changed a tag within each deployment and re-ran the apply, which did update the state file for the remainder.

I’m now facing the same issue in trying to upgrade to 0.15.3.

@ryanps, the state file is only updated if there are changes to be written. What you are seeing is expected if the data in the state is unchanged.

Thanks for getting back to me. I was under the impression that no change was required to the resources to perform a Terraform version upgrade (as was the case upgrading to 0.13.6). For a very small minority of the upgrades to 0.14.6 (and initial testing with 0.15.3) these also upgraded the state file version with no changes to resources, so something doesn’t seem quite right in any case.

Terraform may update any of the structures within in the state when upgrading, and if the resulting file differs in any way the new version will recorded in the state as well. This all internal implementation details, so allowing terraform to write a new state, whether it changes or not, is all that is required for upgrading.

1 Like