user variable

12 views
Skip to first unread message

t3e...@gmail.com

unread,
May 17, 2018, 7:03:32 AM5/17/18
to Packer
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




Rickard von Essen

unread,
May 17, 2018, 7:14:11 AM5/17/18
to packe...@googlegroups.com
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

--
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+unsubscribe@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.
For more options, visit https://groups.google.com/d/optout.

t3e...@gmail.com

unread,
May 18, 2018, 6:06:29 AM5/18/18
to Packer
Thanks for the correction
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages