Chapter 2 · Practice 4 of 4
Upgrade Terraform and providers one step at a time
Why it matters
Upgrading Terraform, three providers and two modules in one pull request makes any surprise in the plan impossible to trace. Treat upgrades like any other change: small, planned and reviewed.
A steady routine:
- Read the upgrade notes or changelog for the version you are moving to.
- Change one thing: the Terraform version, or one provider, or one module.
- Run
terraform init -upgradeandterraform plan. - Expect no changes in the plan for a pure upgrade. Any change is either a new default or a bug, and should be understood before you apply.
- Commit the updated lock file with the constraint change.
Avoid
- Bumping several providers and Terraform in one pull request
- Applying an upgrade whose plan shows changes nobody can explain