This article discusses the latest Terraform v0.12 update and its effects on Spotinst users who are using the official Spotinst provider from HashiCorp.

The Update

Terraform version 0.12 comes with several updates and changes to the syntax of Terraform configuration (*.TF) files. You can read more about it in the Change Log.

The official Spotinst Terraform provider has been updated to work with those changes, and also comes with backward compatibility with previous versions.

Follow according to your use case:

  1. Upgrading from Terraform v0.11 to Terraform v0.12
  2. Keep working with TF v0.11 and the latest provider


Use Case 1 – Upgrading from Terraform v0.11 to Terraform v0.12

In order to upgrade to TF v0.12, you can follow this guide by Hashicorp.

Once you have upgraded to TF v0.12, you will need to update your configuration files to the new schema.  To that end, Terraform v0.12 includes a new command that will read the configuration files for a module written for Terraform 0.11 and update them in-place to use the cleaner Terraform 0.12 syntax.

To use the command you need to:

  • Run terraform 0.12upgrade within a fully-initialized working directory that contains the TF files.
  • The command will prompt for confirmation. Confirm the changes and the .tf and .tfvars files in your current working directory will be rewritten.
  • The output should look like so:
  • When the updates are done, you can use your version control tool to review any proposed changes and then run terraform plan to see the effect of the changes that were made. In most cases, terraform plan should report that no changes are required because the updated configuration is equivalent to the previous one.
  • Once you’re happy with the updated configuration, commit it to version control in the usual way and terraform apply it with Terraform 0.12.

Use Case 2 – Keep working with TF v0.11 and the latest provider

If you keep working with older versions of TF, running terraform init will still upgrade your Spotinst provider to the latest version.

The latest Spotinst provider version is compatible both with TF v0.12 and TF v0.11, and no further steps are required.