Terraform AWS provider 5.0 adds updates to default tags
Version 5.0 of the HashiCorp Terraform AWS provider brings improvements to default tags, allowing practitioners to set tags at the provider level.
We are excited to announce the release of version 5.0 of the Terraform AWS provider with highly anticipated updates to default tags. Initially launched in May 2021, default tags can now be set at the provider level, which applies them across all resources that support them in the configuration. This post reviews the details and benefits of this updated feature and also covers a handful of new features released this year.
» 2023 highlights
As the Terraform AWS provider download count tops 1.7 billion, AWS and HashiCorp continue to develop new integrations to help customers work faster, use more services and features, and enjoy developer-friendly ways to provision cloud infrastructure. This year we focused on improving the user experience for practitioners by adding new services to the AWS provider including:
- Amazon CloudWatch Observability Access Manager
- Amazon EC2 Recycle Bin
- Amazon QuickSight
- Amazon VPC Lattice
- AWS Directory Service trust relationships
- Amazon EventBridge Pipes
» Default tags enhancements
Default tags in the Terraform AWS provider allow practitioners to define common metadata tags at the provider level. These tags are then applied to all supported resources in the Terraform configuration. Previously, assumptions and restrictions were made to allow this feature to function across as many resources as possible. However, it could be difficult to retrofit existing code, causing frustrating manual intervention.
Thanks to new features available in the Terraform plugin SDK and the Terraform plugin framework, we have removed several limitations which made default tags difficult to integrate with existing resources and modules.
The updates in version 5.0 solve for:
- Inconsistent final plans that cause failures when tags are computed.
- Identical tags in both default tags and resource tags.
- Perpetual diffs within tag configurations.
These changes make the behavior align more consistently with community expectations. You can find more details about the updates to default tags in the AWS provider changelog.
Default tags are an easy way to standardize your Terraform configuration in accordance with AWS’s recommended best practices.
This example shows how default tags can be used to apply common metadata to a Terraform configuration:
provider "aws" {
default_tags {
tags = {
environment = "Dev"
department = "WebEng"
application = "HashiCafe website"
cost_center = "8675309"
}
}
}
resource "aws_s3_bucket" "example" {
bucket = "example-bucket-aj-11122"
tags = {
environment = "Production"
created_at = timestamp()
}
}
» Changes and deprecations
» Remove deprecated attributes
Previously when using attributes marked as deprecated or removed, users would receive a “warning” notification. With this release, users will no longer receive a warning detailing what attribute to use. Instead, users will receive an “unsupported error” as these attributes will be removed. This will help ensure practitioners are using best practices and are not using outdated features.
» Remove EC2 classic functionality
While the AWS team removed EC2-Classic networking functionality back in August 2022, the Terraform AWS provider team worked closely with AWS to extend support for the functionality until late September. This allowed any AWS customers who had qualified for extension to be able to finish their migration. These features were marked as deprecated and it is now time to remove them as the functionality is no longer available through AWS. Practitioners should experience no changes as all AWS users have now fully migrated off EC2-Classic networking functionality.
» Key benefits
The release of version 5.0 of the Terraform AWS provider allows practitioners to more efficiently manage tags for the provider. Here are a few of the main benefits of this new release:
- Increase productivity: Application developers will now be able to set default tags without having to manually update existing resource-level configurations. This provides an improved user experience and simplifies practitioner configurations.
- Reduce risk: Platform teams now have increased resource coverage for the new services added, significantly reducing the time and customization it takes to support those new capabilities.
» Learn more about AWS and HashiCorp
Developers can use the Terraform AWS provider to interact with the many resources supported by AWS. To learn the basics of Terraform using this provider, follow the hands-on tutorials for getting started with Terraform on AWS on our developer education platform.
When upgrading to version 5.0 of the Terraform AWS provider, please consult the upgrade guide on the Terraform Registry, as it contains not only a list of changes but also examples. Because this release introduces breaking changes, we recommend pinning your provider version to protect against unexpected results.For a complete list of the changes in 5.0, please reference the AWS provider changelog.
Please share any bugs or enhancement requests with us via GitHub issues. We look forward to your feedback and want to thank you for being such a great community!
If you are currently using Terraform open source or are completely new to Terraform, you can sign up for Terraform Cloud and get started using the Free offering today.
Sign up for the latest HashiCorp news
More blog posts like this one
New Terraform integrations with Crowdstrike, Datadog, JFrog, Red Hat, and more
12 new Terraform integrations from 9 partners provide more options to automate and secure cloud infrastructure management.
Terraform delivers launch-day support for Amazon S3 Tables, EKS Hybrid Nodes, and more at re:Invent
The Terraform provider for AWS now enables users to manage a variety of new services just announced at re:Invent.
HashiCorp at re:Invent 2024: Infrastructure Lifecycle Management with AWS
A recap of HashiCorp infrastructure news and developments on AWS from the past year, from a new provider launch to simplifying infrastructure provisioning and more.