Upgrade minor version - what are the steps?

Sorry, I know this is a dumb question but I cannot find any instructions. And I am paranoid messing up or corrupting state files. So many times a one line change in devops leads to days of headaches.

What is the proper steps to upgrade minor version? I simply download the new version and then run terraform init and then terraform apply? For example to upgrade from 0.11.7 to 0.12 I first need to upgrade to 0.11.14. So I download 0.11.14 and use that when running terraform init and then terraform apply?

I am using workspaces and state files stored using S3 backend. Can I safely test this process for one of the workspaces before applying the same to the other workspaces?

Upgrading to a new minor version does not require any special preparation steps.

The main thing to watch out for is that running commands that make changes to the state (terraform apply, terraform refresh, terraform state mv, terraform state rm) will produce a new state snapshot that earlier versions of Terraform will no longer consume. Because of that, I’d suggest running terraform plan after you’ve upgraded (which does not create a new state snapshot) to verify that it works and no changes are proposed.

The guideline about creating new state snapshots applies on a per-workspace basis, so if you are using multiple workspaces on the same configuration you can safely run terraform apply on one of them without affecting the others. terraform apply only affects the currently-selected workspace.

2 Likes

Thank you. It is very comforting to know I can do this in a separate workspace to test it to see if something explodes before repeating for prod workspace.