Terraform
Upgrading to Terraform v1.11
Tip: Use the version selector to view the upgrade guides for older Terraform versions.
Terraform v1.11 is a minor release in the stable Terraform v1.0 series.
Terraform v1.11 honors the Terraform v1.0 Compatibility Promises. There are minor changes that may require additional upgrade steps:
- Attempting to override a variable during apply via TFVAR environment variable will now yield warning instead of misleading error.
See the full changelog for more details. If you encounter any problems during upgrading which are not covered this guide, please start a new topic in the Terraform community forum to discuss it.
Terraform Test
- The
-junit-xml
option for the terraform test command is now generally available. This option allows the command to create a test report in JUnit XML format. Feedback during the experimental phase helped map terraform test concepts to the JUnit XML format, and new additons may happen in future releases. - Test runs now support using mocked or overridden values in unit tests (i.e., with command = "plan"). Set override_during = plan in the run block to use the overridden values during the plan phase. The default value is
override_during = apply
. - Run blocks now support a
state_key
attribute, allowing test authors control over which internal state file should be used for the current test run.
S3 Native State Locking
S3 native state locking is now generally available. The use_lockfile argument enables users to adopt the S3-native mechanism for state locking. As part of this change, we've deprecated the DynamoDB-related arguments in favor of this new locking mechanism. While you can still use DynamoDB alongside S3-native state locking for migration purposes, we encourage migrating to the new state locking mechanism.
To opt-in to S3 native state locking, set use_lockfile
to true
.
terraform {
backend "s3" {
# additional configuration omitted for brevity
use_lockfile = true
}
}
With S3 locking enabled, a lock file will be placed in the same location as the state file.
The lock file will be named identically to the state file, but with a .tflock
extension.
S3 bucket policies and IAM policies attached to the calling principal may need to be adjusted to include permissions for the new lock file.