You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing some code to take in an HCL file (Packer in this case) and perform some transformations on it (it's a shame the JSON is deprecated as this was an easier format to parse, but that's another thing).
I'm not sure if it's something I'm not doing right or if this is perhaps a bug?
I get the attributes attrs := build.Body().Attributes() (build is a Block within the HCL file) and then clear the build (build.Body().Clear()) element for injecting the extra blocks I need.
Obviously to get it back to the same state I need to now re-set the Attributes and munged Blocks onto the build Block.
I'm writing some code to take in an HCL file (Packer in this case) and perform some transformations on it (it's a shame the JSON is deprecated as this was an easier format to parse, but that's another thing).
I'm not sure if it's something I'm not doing right or if this is perhaps a bug?
I get the attributes
attrs := build.Body().Attributes()
(build
is a Block within the HCL file) and then clear the build (build.Body().Clear()
) element for injecting the extra blocks I need.Obviously to get it back to the same state I need to now re-set the Attributes and munged Blocks onto the
build
Block.I do this with the following (for Attributes):
I can then get the new Attributes print the result of the
Attributes
method and see the correct output:Output:
sources = ["source.azure-arm.build_vhd"]
This successfully prints Attributes, however when I go to then write the file back out, the Attributes are missing:
Expecting:
Received:
It seems somehow by setting Attributes there on the Body element but don't get considered when written back out to a file.
The text was updated successfully, but these errors were encountered: