Yes it works, but your example is a bit wrong. It should be like this:

{
  "variables": {
     "ami_name": "Default name",
     "ami_description": "Default description"
  },
  "builders": [{
     ...
     "ami_name": "{{ user `ami_name` }},
     "ami_description": "{{ user `ami_description` }},
     ...
  }]
}

And then:

packer build -var ami_name=Test -var ami_description=testdescription
template.json

On 17 May 2018 at 13:03, <t3e...@gmail.com> wrote:

> can anyone advise if you are able to use ami_description as a user
> variable,
>
> e.g.
>
> "variables": {
>     "AMIName": "{{`AMIName`}}",
>     "ami_description": "{{`AMIDescription`}}",
>   },
>
>
> and then pass
>
> packer build \ -var 'AMIName=Test' \ -var 'ami_description=testdescription'
> \ template.json
>
>
>
>
> --
> 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/eb35ef96-0af8-451e-af5a-8a59ff124274%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/eb35ef96-0af8-451e-af5a-8a59ff124274%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 packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt-ruJQEUG1GiOVV9wUpT3ZRuZ85hSM-_9n3mUCujtPJOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to