To attach multiple tags to a resource, I currently use multiple tag
blocks:
resource "aws_autoscaling_group" "instance" {
...
tag {
key = "Name"
value = "${var.cluster_prefix}"
propagate_at_launch = true
}
tag {
key = "Owner"
value = "${var.tag_Owner}"
propagate_at_launch = true
}
tag {
key = "Project"
value = "${var.tag_Project}"
propagate_at_launch = true
}
}
It works, but I wonder if there is a more concise syntax. It is also a bit error prone as you have to specify propagate_at_launch
for each tag.
Update: The question was written before Terrafrom v0.12 came out. Since then the support has improved with Dynamic Nested Blocks (see my answer below).