Intro
This guide will walk you through how to update any code that depends on the Gruntwork Infrastructure as Code Library to Terraform 0.14. Terraform 0.14 introduces several new features and fixes, but it also has a number of backwards incompatibilities that have to be incorporated into your codebase.
What you’ll learn in this guide
This guide consists of two main sections:
- Core Concepts
-
An overview of Terraform 0.14 and why it is important to update your code for compatibility.
- Deployment walkthrough
-
The steps you need to take to update your code relying on the Gruntwork Infrastructure as Code library to work with Terraform 0.14. Includes a version compatibility table you can use as a reference to know which Gruntwork Repo version tag is compatible with Terraform 0.14.
Core Concepts
Background
Terraform 0.14 was released on December 02, 2020. Some of the major new features in 0.14 include:
-
Consise diff output in
plan
. -
The ability to mark input variables as
sensitive
. -
A lock file for provider dependency versions.
For more info, check out the announcement blog post.
0.14 is a major new release for Terraform, which means it includes some backwards incompatible changes. We have gone through all the Terraform modules in the Gruntwork Infrastructure as Code Library and updated them to work with Terraform 0.14. In order to use 0.14, you will need to update to these new versions and make other changes to your code, as described in the following section.
Deployment walkthrough
Step 1: update your code to be compatible with Terraform 0.13
If you haven’t already, you need to:
-
Update your code to work with Terraform 0.13. Do NOT skip from, say, 0.11, straight to 0.14. You MUST update to 0.13.0 or above first! If you’re still on Terraform 0.11 or older, see our Terraform 0.12 upgrade guide for instructions. If you’re still on Terraform 0.12, see our Terraform 0.13 upgrade guide.
-
Update all your Gruntwork modules to the latest versions just before the TF 0.14 versions in the compatibility table below. The upgrade will be much easier and less error prone if you keep the number of version jumps as small as possible.
Step 2: update your code to be compatible with Terraform 0.14
The first step is to update your own code (e.g., the code that lives in your infrastructure-modules
repo) to be
compatible with Terraform 0.14 by following HashiCorp’s Terraform 0.14
Upgrade Guide.
Step 3: update references to the Gruntwork Infrastructure as Code Library
In order to take advantage of the Terraform 0.14, you need to update your references to the Gruntwork Infrastructure as Code Library to use a compatible version. We (Gruntwork) have gone through all our modules in the library to test and update the code to be compatible with Terraform 0.14. As a customer, you need to update to the proper versions of the Gruntwork library to pick up the fixes/changes that we made to be compatible. Refer to the "Updating" section of "How to use the Gruntwork Infrastructure as Code Library" for instructions on how to update the versions in your code.
For the vast majority of the repos, the only change that will be necessary is a version number bump, but several repos require more extensive code changes and state migrations. To upgrade without downtime and data loss, you MUST follow the migration instructions in the release notes in each repo to know what changes need to be made to update to the new version.
Important
|
Gruntwork follows semantic versioning. For any pre-1.0 modules, this means that version updates to the minor version are considered backwards incompatible releases for any version updates prior to 1.0.0 release. Make sure to read the release notes for the relevant modules any time you are updating minor versions! Note that you will want to read the release notes for each minor version that is updated (e.g., if you are going from v0.5.x to v0.9.x, you will want to read the notes for v0.6.0, v0.7.0, v0.8.0, and v0.9.0 to get the full list of backwards incompatible updates). |
The following table provides a summary of all the relevant Gruntwork AWS modules and the respective versions that are compatible with Terraform 0.14:
Gruntwork Repo | Minimum version with Terraform 0.14 support |
---|---|
Terratest |
|
Terragrunt |
|
terraform-aws-utilities |
|
terraform-aws-vpc |
|
terraform-aws-asg |
|
terraform-aws-server |
|
terraform-aws-lambda |
|
terraform-aws-security |
|
terraform-aws-load-balancer |
|
terraform-aws-data-storage |
|
terraform-aws-cache |
|
terraform-aws-messaging |
|
terraform-aws-static-assets |
|
terraform-aws-monitoring |
|
terraform-aws-openvpn |
|
terraform-aws-ecs |
|
terraform-aws-ci |
|
terraform-aws-eks |
|
terraform-aws-zookeeper |
|
terraform-aws-kafka |
|
terraform-aws-elk |
|
terraform-kubernetes-namespace |
|
terraform-aws-cis-service-catalog |
|
terraform-aws-sam |
|
terraform-aws-couchbase |
|
terraform-aws-vault |
|
terraform-aws-consul |
|
terraform-aws-nomad |
|
terraform-aws-architecture-catalog |
|
terraform-aws-service-catalog |
Step 4: start using lock files
One of the big new features in Terraform 0.14 is the lock file for provider dependencies. The next time you run init
with Terraform 0.14, it will create a .terraform.lock.hcl
file that locks you to specific versions of all the
providers you’re using. We recommend checking the .terraform.lock.hcl
files into version control so that all your
team members get the exact same provider versions when they run init
.
Note that we’ve updated Terragrunt (as of v0.27.0) to
work with lock files too. When you run terragrunt init
, or when
Auto Init runs as part of some other command, Terragrunt will
automatically copy the .terraform.lock.hcl
file right next to your terragrunt.hcl
file, making it easy to commit it
to version control.
Comments