Dusayanta Prasad
Dusayanta Prasad

Reputation: 349

Can we use the same Terraform state file after upgrading Terraform?

I am using Terraform v0.12.31 and planning to upgrade to v1.2.3 .

I checked one of the Terraform State file -

{
  "version": 4,
  "terraform_version": "0.12.31",
  "serial": 2,
  "lineage": "bb737776-5b8a-9771-fa63-453a99ef75dd",
  "outputs": {}
}

Terraform version is tied to the state file.
After upgrading Terraform, are the same old state files going to work ?
OR
Is there any way we can make it work ?

Upvotes: 0

Views: 2277

Answers (1)

Mark B
Mark B

Reputation: 200501

Yes, as part of the upgrade process it will update the version in the state file, and possibly update some of the formatting and values in the state file.

I recommend going through the Terraform upgrade guides here.

Upvotes: 2

Related Questions