Terraform Files in v0.11.14 Convert to v1.1

I have Terraform main.tf, ignition.tf and Terraform.tfvars written in v0.11.14

What is the process to convert the files to the latest Terraform version, for example v1.1

Thanks

I would say to follow the official process which is doing incremental version jumps.

What I did was to

  1. First upgrade to Terraform v0.12.x . This is largest effort and biggest upgrade. Upgrading to Terraform 0.12 | Terraform by HashiCorp
  2. Then upgrade to Terraform v0.13.x. - Upgrading to Terraform v0.13 | Terraform by HashiCorp
  3. In some cases, you can then upgrade directly to v1.1.x - which in most cases is just switch Terraform version and run plan / apply.

When I mean upgrade, I mean update the code and also fully running terraform apply. Both the code and TFstate file needs to be fully updated.

Trying to upgrade directly from v0.11 to v1 is going to be chaotic and can be unpredictable. It can be unpredictable as the formats in the TFstate files have changed dramatically over the versions, it could end up messing it up.

This is a good answer. The upgrades from v0.11 to v0.12 and from v0.12 to v0.13 are the ones which are involved enough to benefit from helper commands as part of the upgrade process, and those helper commands are not available in later versions of Terraform and so that’s the main reason to do those step-by-step.

As @mechastorm noted, you may be able to jump directly from v0.13 to v1.1 after that, but you should still be sure to carefully consider all of the information in the intermediate release notes to see if any of the special situations apply to you. The situations requiring special steps for those versions are typically for less common cases and so don’t apply to everyone, but if they do apply to you then it’s typically easier to address them with one upgrade at a time, so that you don’t find a situation where two special situations combine to produce a confusing result.

The remaining upgrade guides to consider to decide if you can jump from v0.13 directly to v1.1 are:

Great input and I have looked at those links. So to be safe upgrade in increments. Also, is their a simulator type of tool that you can input your tf file written in say v0.11.14 to see what the required changes/diff are to change to make it valid for v0.12.0 outside of running terraform init?

Make sense?

The upgrade tools are built into Terraform CLI itself, so you would see the effect of upgrading by running the upgrade tools described in the upgrade guide against a local working directory on your computer.

The upgrade tool only modifies files on your local system, so you can reset the files using your version control system if you don’t wish to move forward with upgrading immediately.

Great and thanks for pointing that out. I will test this out and report back.