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