In your example you have two errors in:
{
"build_with_ami": "ami-whatever",
}
1) Trailing , - that is invalid JSON formatting.
2) "build_with_ami" is without capital B and thus doesn't match
"Build_with_ami".
On 10 August 2016 at 20:03, DarwinJS <[email protected]> wrote:
>
> I have this in "variables" in my main template.
> "variables": {
> "Build_with_ami": "",
> }
>
>
> I have this in "builders" of my main template:
> "type": "amazon-ebs",
> "source_ami": "{{user `Build_with_ami`}}",
>
>
> If I use packer -var 'Build_with_ami=ami-whatever' it works fine.
>
> If, however, I put this in a varfile:
>
> {
> "build_with_ami": "ami-whatever",
> }
>
> and use -var-file 'variablefile.json'
>
> Packer errors saying I must specify source_ami.
>
> I have also tried using "source_ami" directly.
>
> I have also tried removing it from the variables section in the template
> (but retaining the variables section itself.
>
> I have tried -var-file='variablefile.json'
>
> FYI -var-file=variablefile.json has the extension stripped off it when
> executing under powershell.
>
> The only way Build_with_ami is recognized is if I set it on the command
> line or directly in the template "variables" section.
>
> The log file does not show variables nor where they are read from - would
> be nice for debugging this.
>
> All of the above is under PowerShell 5.0
>
> --
> 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/28a6b81b-d87a-41c1-a9e7-c5ff8b46ee3a%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/28a6b81b-d87a-41c1-a9e7-c5ff8b46ee3a%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/CALz9Rt_XvbdYDq%3DS3AMJ08ZxU3syWo6YMKz1esCCvjWLcM_9rg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.