[AWS] Pass tags to module creating an ASG
hashibot opened this issue · 5 comments
This issue was originally opened by @mcinteer as hashicorp/terraform#9098. It was migrated here as part of the provider split. The original body of the issue is below.
Hi there,
Terraform Version
$ terraform -v
Terraform v0.7.4
Affected Resource(s)
Please list the resources as a list, for example:
- aws_autoscaling_group
Terraform Configuration Files
This is an ASG defined in a module with some default tags:
resource "aws_autoscaling_group" "asg" {
name = "${var.env}-${var.cell}-${var.app}"
launch_configuration = "${aws_launch_configuration.lc.name}"
.
.
.
tag {
key = "Name"
value = "${var.env}-${var.app}"
propagate_at_launch = true
}
tag {
key = "app"
value = "${var.env}-${var.app}"
propagate_at_launch = true
}
.
.
.
Info
I'd like to be able to pass this module some extra tags to add to the ASG. for example if I have a couple of different stacks using this module and they both require these default tags but then one of them requires some additional tags. Is this available already? I've done a fair amount of googling on this but cannot find anything on it.
It seems that because each tag is added individually rather than a list of tags that I can't add to the list. Is there a workaround for this or can we get it implemented?
Thanks,
Ryan
This is covered in the docs here: https://www.terraform.io/docs/providers/aws/r/autoscaling_group.html#interpolated-tags
You can pass in a variable that has type list them concat them
It will be great to be able to initialize the tags from a map. As mentioned in the original issue, the preferred option is to be able to do
`resource "aws_autoscaling_group" "bar" {
...
tags_propagated = {
Name = "my-name"
AnotherTagForInstances = "foo"
}
tags = {
MyTagForASGNotPropagted = "baz"
}
}`
You can pass in a variable that has type list them concat them
You can do that. The problem is -- let's say that you have a module that creates an ASG, but also something like a security group, which accepts tags as a map. And you want to be able to define a set of "global tags", that are applied to all resources created by the module. There's no way use the same var.tags
input for both the ASG and the security group
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.
If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!