Closed nitrocode closed 3 years ago
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.
This issue has been automatically migrated to hashicorp/packer-plugin-amazon#10 because it looks like an issue with that plugin. If you believe this is not an issue with the plugin, please reply to hashicorp/packer-plugin-amazon#10.
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.
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.
Feature Description
I'd like to make
run_tags
the same astags
using a boolean like"tags_same" = true,
or similar which can make all tagging the same as what is defined intags
.Use Case(s)
Tired of adding new tags to one but not the other. I'd like to keep things DRY as much as possible.