I have a script in provisioner's section of my Packer template, which requires the variable $ami_name
. Is there any way that I can reliably get this information?
Provisioners section
"provisioners": [
{
"type": "shell",
"execute_command": "sudo {{.Vars}} bash '{{.Path}}'",
"scripts": [
"./scripts/packer/myscript.sh"
]
}
]
./scripts/packer/myscript.sh:
#!/usr/bin/env bash
aminame=$ami_name
make_an_external_call "$aminame"
Here I need to get the ami_name from Packer. As this provisioners stage happens after Packer does a pre-validation of AMI Name, there should be a way I can get this right?