I'm trying to pass ami_regions list as an user variables and I'm unsuccessfully. There was a bug for this https://github.com/hashicorp/packer/issues/950 opened before. Could this be regression or am I doing something wrong ?
Packer version: 1.0.0
User variable in the ami.json file: "ami_regions": [ "{{ user aws_regions
}}" ],
Debug output:
`packer build -debug -var 'ami_regions=us-east-1,us-west-2' ami.json
Debug mode enabled. Builds will not be parallelized.
amazon-ebs output will be in this color.
1 error(s) occurred:
try "ami_regions": "{{ user aws_regions }}"
this worked for me
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"region": "{{env `AWS_DEFAULT_REGION`}}",
"matt_regions": "us-west-1,us-west-2"
},
"builders": [
{
"access_key": "{{user `aws_access_key`}}",
"ami_name": "packer-qs-{{timestamp}}",
"instance_type": "t2.micro",
"region": "us-east-1",
"ami_regions": "{{user `matt_regions`}}",
"secret_key": "{{user `aws_secret_key`}}",
"source_ami": "ami-fce3c696",
"ssh_username": "ubuntu",
"type": "amazon-ebs"
}
]
}
Most helpful comment
try
"ami_regions": "{{ user aws_regions }}"
this worked for me