I am currently working on building a packer builder that can be used for multiple components. The builder data is mostly stored in variables that are interpolated during the execution of the code. This means that the packer file does not need to be specific to any particular instance file.
I recently discovered that when trying to use variables for ami_block_device_mappings, I can do so using a list variable in JSON, but not in HCL2. The documentation states that for each block device, an independent ami_block_device_mappings is required, which would force me to use JSON to make the code more generic (for example, one component may need 1 disk, while another may need 2).
I am wondering if there is any other way to address this issue without having to move to JSON? Any suggestions or tips would be greatly appreciated. Thank you!