-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AWS] Pass tags to module creating an ASG #9098
Comments
Been thinking a little more about this this evening and looking at the way the autoscaling group is implemented in TF I think that it would be very difficult to add in extensible tags like I want. Would a potential solution be to create a new resource type call something like |
I have been playing around with the overrides feature built in to terraform to try and achieve this. But it would appear that I cannot override a resource in a module from the root, is this correct? |
+1 |
So, let's compare ASG and single EC2 instance tag description in terraform: ASG:resource "aws_autoscaling_group" "bar" {
...
tag {
key = "foo"
value = "bar"
propagate_at_launch = true
}
tag {
key = "lorem"
value = "ipsum"
propagate_at_launch = false
}
} EC2 Instance:resource "aws_instance" "bar" {
...
tags = {
Name = "HelloWorld"
foo = "bar"
} It would be great to have standard description of tags, smth like ASG:resource "aws_autoscaling_group" "bar" {
...
tags = {
Name = {
value = "my-name"
propagate_at_launch = true
},
MySecondTag = {
value = "tag2"
propagate_at_launch = false
}
}
} In this way tags for ASG can be described in variables.tf and overridden later when module reused. |
Or even simpler: resource "aws_autoscaling_group" "bar" {
...
tags_propagated = {
Name = "my-name"
AnotherTagForInstances = "foo"
}
tags = {
MyTagForASGNotPropagted = "baz"
}
} |
@mitchellh , could you take a look on this (above) |
It would be awesome to have this. Is there any plans to implement it? |
Seriously... is it going to be implemented? Lack of this functionality affects flexibility in writing modules in a hard way |
Is there any news on this? Being able to set tags in the same way as other resources would be a great help for us. |
I think this will issue will resolve it, which is slated for the next release: #13574 |
That issue is good, but I can't think of any way with interpolations to let a module accept a map of tags (to set on VPC/segurity groups say) and to also apply those to ASG-created instances. i.e. Is it possible to go from |
I had to write a script to get around this. Feel free to use it here: https://github.com/carlosonunez/terraform_asg_tag_creator |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi there,
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
This is an ASG defined in a module with some default tags:
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
The text was updated successfully, but these errors were encountered: