Provider version vs Terraform version

How can I tell which terraform version is required by a provider version? For example we are on aws provider 1.9.0. I need to upgrade to 2.22.0 so I can script out code build projects with github token support (

We are on terraform 0.11.7 and I assumed I would need to upgrade to 0.11.14 first and then 0.12 before I can upgrade the provider just to be safe. I am not sure if aws provider 2.22.0 is compatible with terraform 0.11.7 or not.

Hi @cballan,

For upgrading from Terraform 0.11 to 0.12, the terraform 0.12checklist command in Terraform 0.11.14 can tell you if any of your currently-selected provider versions are too old for Terraform 0.12 and suggest a version to upgrade to.

As described in the full upgrade guide, the intended upgrade sequencing to move from 0.11 to 0.12 is:

  • Upgrade to 0.11.14 first, leaving everything else unchanged. terraform plan should work and indicate no changes required, unless one of the minor changes between 0.11.7 and 0.11.14 unexpectedly affect the behavior for your configuration.
  • With your working directory initialized with terraform init on Terraform 0.11.14, run terraform 0.12checklist and it will suggest to you some changes that are better to make prior to upgrading to Terraform 0.12, which includes some necessary provider upgrades.
  • Make any provider upgrades that the checklist tool suggests and, if that includes upgrading across any provider major releases, respond to any upgrade steps required for each provider. Before moving on, ensure that terraform plan works with those new provider versions and produces an empty plan.
  • Upgrade to Terraform 0.12, keeping all of the provider version selections you made in response to 0.12checklist.
  • Run terraform init with Terraform 0.12, and then follow the rest of the upgrade guide steps.

The terraform 0.12checklist tool understands which provider releases are compatible with Terraform 0.12 by querying the Terraform Registry API. Specifically, it accesses the versions endpoint (using the aws provider there just as an example) and looks for versions that list 5.0 as a supported protocol version, which is the protocol version introduced with and required by Terraform 0.12.

1 Like

Thank you @apparentlymart!

This is so helpful! So to be clear “upgrading” is done by simply running terraform init using the new version. This will in turn update the state file with the new version of terraform that it uses. This of course is done after checking no changes are required by running terraform plan.

Close! terraform init must come before terraform plan (so that the plan step can access the backend to fetch the previous state snapshot), and it will not create a new state snapshot.

A new state snapshot is only created if you take an action that modifies the state, such as terraform apply. terraform init and terraform plan only read the latest state snapshot, and do not create new snapshots.

Thanks again! This has made it very clear.
I have managed to upgrade from 0.11.7 to 0.11.14 without dramas. And also upgraded the aws provider. I will be able to continue on now that I know the process to follow.