Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
I'd like to make run_tags the same as tags using a boolean like "tags_same" = true, or similar which can make all tagging the same as what is defined in tags.
Tired of adding new tags to one but not the other. I'd like to keep things DRY as much as possible.
Hello @nitrocode, thanks for opening. We recently merged #8588 that allows to use variables in HCL2. I would like to talk about the feasibility of this in Packer HCL2 and how I think it should/will proably work ( we are not quite there yet ):
1/ I think we should add the possibility to define the tag field instead of tags, to be defined like this:
source "amazon-ebs" "example-source" {
tag {
key = "Name"
value = "example-asg-name"
propagate_at_launch = false
}
//...
I think this would solve one issue here.
2/ from there we will need to introduce the dynamic block from Terraform
locals {
standard_tags = {
Component = "user-service"
Environment = "production"
}
}
source "amazon-ebs" "example-source" {
// same as before
dynamic "tag" {
for_each = local.standard_tags
content {
key = tag.key
value = tag.value
propagate_at_launch = true
}
}
Here are the places where that could be handy:
There are also post-processors where that could be used.
Note that this wouldn't necessarily be a breaking change as a new tag/property field would be introduced. We would have to sort of deprecate tags/properties fields and may be come up with a way to help users fix their templates, ( or don't, and not deprecate anything ).
Hey there, yesterday I opened #8720 that adds support for dynamic blocks. Up next we will need to add that new tag specific type.