Re: [packer] Re: Variable file option in packer

2019-04-01 Thread JP Bourget
This happened to me and it was because for a var-file you don't need the 
"variables": {... 

just open and close { }... 
so {
"var1": "value"
 }



On Thursday, March 14, 2019 at 12:48:18 AM UTC-4, Rickard von Essen wrote:
>
> I don't that will work, it will split on all commas. 
>
> On Wed, Mar 13, 2019, 23:49 Todd Foley > 
> wrote:
>
>> 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" : "1,,",
>>>   "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  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" : ["1", "", ""],
> "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 packer-tool...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/packer-tool/69f3e0be-fb7d-4875-9903-5b65f75a01b6%40googlegroups.com
  
 
 .
 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 packe...@googlegroups.com .
>> 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.
>>
>

-- 
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 packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-too

Re: [packer] Re: Variable file option in packer

2019-03-13 Thread Rickard von Essen
I don't that will work, it will split on all commas.

On Wed, Mar 13, 2019, 23:49 Todd Foley  wrote:

> 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" : "1,,",
>>   "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  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" : ["1", "", ""],
 "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 packer-tool...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/packer-tool/69f3e0be-fb7d-4875-9903-5b65f75a01b6%40googlegroups.com
>>> 
>>> .
>>> 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 packer-tool+unsubscr...@googlegroups.com.
> 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.
>

-- 
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 packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt-r1%3DuxoF7wavrAhDcoozfnWXOeaPdAN1TBAp1KPG8-yQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [packer] Re: Variable file option in packer

2019-03-13 Thread Todd Foley
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" : "1,,",
>   "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 > 
> 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" : ["1", "", ""],
>>> "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 packer-tool...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/69f3e0be-fb7d-4875-9903-5b65f75a01b6%40googlegroups.com
>>  
>> 
>> .
>> 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 packer-tool+unsubscr...@googlegroups.com.
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.


Re: [packer] Re: Variable file option in packer

2018-04-14 Thread Rickard von Essen
Variables should always be strings. Array type options which gets a
variable splits them on comma. You variables.json should be:

{
  "ami_users" : "1,,",
  "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  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" : ["1", "", ""],
>> "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 packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/69f3e0be-fb7d-4875-9903-5b65f75a01b6%40googlegroups.com
> 
> .
> 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 packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt-zk0qHM0K%2Bpq5KrnJFqjtYXz3rAxqJr6RTV9ONKR0owA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[packer] Re: Variable file option in packer

2018-04-13 Thread Bad Santa
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" : ["1", "", ""],
> "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 packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/69f3e0be-fb7d-4875-9903-5b65f75a01b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.