Im trying to pass the result of source_ami_filter (the ami id) as a var into a script that is later run in one of my providers. I cant seem to get anything to work correctly. Other vars are being passed as I would expect except this one.
My filter:
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "*ubuntu/images/hvm-ssd/ubuntu-*-{{user `ubuntu_version`}}-amd64-server*",
"root-device-type": "ebs"
},
"owners": [
"099720109477"
],
"most_recent": true
}
I have tried adding "vendorAMIid={{.SourceAMI}}"
in my environment_vars for the provisioner. Ive tried adding this in my inline before I kick off the bash script. Ive also tried
{{build `SourceAMI`}}
But that wont even validate correctly…
$ packer validate base_ami_ubuntu_001_partition.json
Error: Failed to prepare build: "amazon-ebs"
render 'inline': template: root:1:14: executing "root" at <build `SourceAMI`>:
error calling build: loaded data, but couldnt find SourceAMI in it. in:
vendorAMIid={{build `SourceAMI`}}
What am I missing here??
Im using Packer 1.6.0