Demonstrates how to dynamically apply tags to instances in an Auto Scaling Group based on a variable list of tags.

Terraform Template

variable "extra_tags" {
  default = "[object Object],[object Object]"
}

resource "aws_autoscaling_group" "test" {
  launch_configuration = "aws_launch_configuration.foobar.name"
  max_size = 5
  min_size = 2
  name = "foobar3-terraform-test"

  tag {
    key = "explicit1"
    propagate_at_launch = true
    value = "value1"
  }

  tag {
    key = "explicit2"
    propagate_at_launch = true
    value = "value2"
  }
  vpc_zone_identifier = ["aws_subnet.example1.id", "aws_subnet.example2.id"]
}