The Terraform AWS Provider now offers users the ability to define default tags at the provider level, simplifying tag management.
The HashiCorp Terraform AWS Provider contains over 700 resources to standardize your AWS infrastructure for configuration in accordance with best practices. One of the most common requests we’ve heard is for the ability to define default tags at the provider level of your Terraform configuration. We’re pleased to announce that as of v3.38.0 of the Terraform AWS provider, you are able to define default tags for all resources except Auto Scaling Groups.
You can set default tags in the provider block of your Terraform configuration. Any tags set here will also be inherited by dependent Terraform modules. Setting default tags at the provider level will not supersede tags set on individual resources as resource tags take precedence.
In order to configure default tags you will need:
Due to the dynamic nature of Auto Scaling Groups, they behave differently than other AWS resources. In order to set default tags for AWS Auto Scaling Groups, we recommend a standard workaround: Set locals with the default tag and then merge that into the Auto Scaling group.
Default Tags are an easy way to standardize your Terraform Configuration in accordance with AWS’s recommended best practices. Additionally, simplifying tag management throughout your configuration allows for more readable infrastructure as code.
To learn more about the Terraform AWS provider visit the provider documentation on the Terraform Registry. For more information on this feature consult the Terraform AWS Provider Tagging Guide and the Default Tags feature documentation.
To report bugs and request enhancements for this feature, open an issue on the Terraform AWS Provider repository on GitHub. We would love to hear your feedback.
Version 5.0 of the HashiCorp Terraform AWS provider brings improvements to default tags, allowing practitioners to set tags at the provider level.
Learn how HashiCorp Terraform supports the deployment of Azure Linux container host for Azure Kubernetes Service (AKS).
New CI/CD pipeline templates for GitHub Actions and GitLab CI provide prescriptive guides for integrating with Terraform Cloud, and a new integration tool can help build workflows with other CI/CD platforms.