Reputation: 1965
I am trying to use the default_tag
available for the AWS Terraform provider.
Documentation:
From the doc, it says:
This functionality is supported in all resources that implement tags, with the exception of the aws_autoscaling_group resource.
So, for all resources I have it works very well, except for aws_instance.root_block_device
.
For example, I have:
provider "aws" {
[...]
default_tags {
tags = {
Env = prod
}
}
}
resource "aws_instance" "instance" {
ami = xxx
instance_type = xxx
root_block_device {
volume_size = xxx
volume_type = xxx
}
}
The default tag Env = prod
is correctly added to the instance itself, but not for the root_block_device
block.
So I'm wondering if default_tag
is supported for this? It's true that the documentation says supported in all resources but root_block_device
is only an argument of this resource, so maybe this is the problem?
I'm just looking for a kind of confirmation because the documentation is not very clear on this point.
Upvotes: 2
Views: 812
Reputation: 2774
This is not supported yet. There are two issues are still open
but you can use this workaround solution:
data "aws_default_tags" "example" {}
aws_instance {
volume_tags = merge(data.aws_default_tags.example.default_tags, var.extra_tags)
}
Upvotes: 4