Variables are string -> string key/value pairs. You can't use objects
(maps). See https://packer.io/docs/templates/user-variables.html
In your case the only solution is to use on pair per region, ie:
"variables": {
"kms_key_eu-west-1": "",
"kms_key_eu-north-q": ""
}
etc
On Mon, Oct 29, 2018 at 10:48 PM Alex Gottschalk <[email protected]>
wrote:
> I have a packer recipe that uses var files to fill in account-specific
> parameters at various parts of the build process. This allows us to use
> the same build across multiple accounts from the same source code repo.
>
> I was very happy to discover the "region_kms_key_ids
> <https://www.packer.io/docs/builders/amazon-ebs.html#region_kms_key_ids>"
> parameter, as this will remove an in-house process for distributing the
> packer-built AMI across the regions we utilize. I would like our var files
> to look something like this:
>
> {
> "somevar": "someval",
> "kms_key_ids_by_region": {
> "us-east-1": "keyid",
> [...]
> }
> }
>
> However I have run into a snag, with the issue
> https://github.com/hashicorp/packer/issues/2441 and the error "Error
> reading variables in 'test.json': json: cannot unmarshal object into Go
> value of type string" It looks like putting maps into a variable file is
> not a supported operation. My questions are, is there any timeline for
> fixing this? Is there a recommended workaround? Having a separate
> manifest per account is a pretty bad DRY violation.
>
> Thanks!
> --Alex
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/eeb756c9-3b1c-4243-ac5b-149b3e0125ee%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/eeb756c9-3b1c-4243-ac5b-149b3e0125ee%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/CALz9Rt878yK2KHzKZ_7X%3D6qNiCmjBnjiKiDF_HFsQ8mDz_JHjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.