How do we make the launch_template resource created by terraform, add tags to the EBS volume created and which is attached to the used AMI ?
Use tag_specifications
with resource_type
of volume
.
resource "aws_launch_template" "foo" {
name = "foo"
block_device_mappings {
device_name = "/dev/sda1"
ebs {
volume_size = 20
}
}
image_id = "ami-test"
instance_type = "t2.micro"
key_name = "test"
tag_specifications {
resource_type = "instance"
tags = {
Name = "test"
}
}
tag_specifications {
resource_type = "volume"
tags = {
Name = "test"
}
}
}