Use this data source to get the default tags configured on the provider.
With this data source, you can apply default tags to resources not _directly_ managed by a Terraform resource, such as the instances underneath an Auto Scaling group or the volumes created for an EC2 instance.
data "aws_default_tags" "example" {}
provider "aws" {
default_tags {
tags = {
Environment = "Test"
Name = "Provider Tag"
}
}
}
data "aws_default_tags" "example" {}
resource "aws_autoscaling_group" "example" {
# ...
dynamic "tag" {
for_each = data.aws_default_tags.example.tags
content {
key = tag.key
value = tag.value
propagate_at_launch = true
}
}
}
This data source has no arguments.
This data source exports the following attributes in addition to the arguments above:
tags
- Blocks of default tags set on the provider. See details below.key
- Key name of the tag (i.e., tags.#.key
).value
- Value of the tag (i.e., tags.#.value
).