what happens when you have a nested comma? 
example: 

{
  "variables": {
    "changes": "CMD [\"/bar\"],ENTRYPOINT [\"/foo\",\"--\"]"
  },

  "builders": [
    {
      "type": "docker",
      "image": "ubuntu:16.04",
      "run_command": ["-d", "{{.Image}}"],
      "changes":      "{{ user `changes`}}",
      "commit": true
    }
  ],
  "post-processors": [
    [
      {
        "type": "docker-tag",
        "repository": "my/ubuntu",
        "tag": "16.04"
      }
    ]
  ]
}





On Saturday, April 14, 2018 at 4:02:55 AM UTC-7, Rickard von Essen wrote:
>
> Variables should always be strings. Array type options which gets a 
> variable splits them on comma. You variables.json should be:
>
> {
>   "ami_users" : "1111111111111,222222222222,333333333333",
>   "ami_regions": "us-east-1,eu-west-1"
> }
>
>
> And in your packer template you use them like this:
>
> {
>   "variables": {
>     "ami_users": null,
>     "ami_regions": null
>   },
>   "builders": [
>     {
>        "type": "amazon-ebs",
>        "ami_users": "{{ user `ami_users` }}"
>      }
>   ]
>
> See
>
> https://www.packer.io/docs/templates/user-variables.html#using-array-values
>
> On 14 April 2018 at 02:39, Bad Santa <[email protected] <javascript:>> 
> wrote:
>
>> I also have this issue. Were you able to resolve it?
>>
>> On Monday, November 30, 2015 at 4:31:35 AM UTC-8, Sandeep Sharma wrote:
>>>
>>> Hi
>>>
>>>
>>> I have three aws accounts so trying to use variable file for AMI 
>>> permission. 
>>>
>>> variables.json
>>>
>>> {
>>> "ami_users" : ["1111111111111", "222222222222", "333333333333"],
>>> "ami_regions": ["us-east-1", "eu-west-1"]
>>> }
>>>
>>> ]# packer build -var-file=variables.json /tmp/test.json
>>> invalid value "variables.json" for flag -var-file: Error reading 
>>> variables in 'variables.json': json: cannot unmarshal array into Go value 
>>> of type string
>>>
>>>
>>> Is this correct?
>>>
>>> Regards
>>> Sandeep Sharma
>>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/69f3e0be-fb7d-4875-9903-5b65f75a01b6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/packer-tool/69f3e0be-fb7d-4875-9903-5b65f75a01b6%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/c14ad29f-8e02-40c8-86b0-3e28efba9db1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to