This message is extracted from a ticket originally emailed to support@gruntwork.io. Names and URLs have been removed where appropriate.
I am trying to add tags on resources as EC2 instances. I work in infrastructure-modules/services/ecs-cluster
in main.tf
file of the ecs-cluster I can have:
custom_tags_ec2_instances = "${var.custom_tags_ec2_instances}"
In the var.tf
I can have:
variable "custom_tags_ec2_instances" {
description = "A list of custom tags to apply to the EC2 Instances in this ASG. Each item in this list should be a map with the parameters key, value, and propagate_at_launch."
type = "list"
default = [{
key = "environment"
value = "some-value"
propagate_at_launch = true
}]
}
The above configuration works and the tags appear under the resources. But I cannot change the value to a variables, the terraform returns:
Variable 'custom_tags_ec2_instances': cannot contain interpolations
The output looks expected, I read on the internet when interpolation is allowed. How can I set this value to be showing the content of "${var.cluster_name}"
for example? Thank you.