Closed Erouan50 closed 4 years ago
@Erouan50 Try using tags = { ... }
. The assignment is important in HCL for it to create a map. Without the assignment, it's a "block" (which is a bit like a list of maps, instead of a map).
@lorengordon I did try that as well, unfortunately the argument is not supported as well:
packer build test.pkr.hcl
Error: Unsupported argument
on test.pkr.hcl line 7, in source "amazon-ebs" "fedora":
7: tags = {
An argument named "tags" is not expected here.
==> Builds finished but no artifacts were created.
Oof, well, yeah, definitely a bug if neither works!
Hello there, thanks for reporting, this should be fixed in #8574; some binaries can be found here: https://circleci.com/gh/hashicorp/packer/27597#artifacts/containers/0
@azr it fixes the issue, 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 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.
Overview of the Issue
I was trying to convert our JSON configuration to HCL2 synthase, but I got an unsupported block error regarding the
tags
block from amazon-ebs. I believe I'm using the right way (see the reproduce part). I also tried to declare my tags as an attribute instead of a block as well, without success.I tried to quickly figure out where the issue could come and I think the
mapstructure-to-hcl2
generator might don't know what to do with the type common.TagMap here: https://github.com/hashicorp/packer/blob/0785c2f6fca9c22bf25528e0176042799dd79df9/builder/amazon/ebs/builder.hcl2spec.go#L165The
run_volume_tags
andsnapshot_tags
blocks seem to have the same issue.Reproduction Steps
Try to build the build file from below, you should get the following error:
Packer version
Packer v1.5.1
Simplified Packer Buildfile