Packer Password for AMI for multiple environment

Hello ,
I have a question that if we are building ami using windows how to keep diff password for different environments e.g dev, staging, production etc ?
( info : We create AMI and promote it to env )
Any leads would be appreciated.

Hi! Sounds like what you need is variables for your passwords. You can create a variable file for each environment and call the build using the appropriate variable file. For example, packer build --var-file=dev.json my_ami_template.json Here are some docs on how to use variables from a file to help you understand the format:

Hi! I tried to open this link you provided above, but it shows page not found.
I am trying to pass 5 values to a variable and the values are links to websites. How can I go about about it using json?

I guess this link is the current version of the link initially posted : User Variables - Templates | Packer by HashiCorp

1 Like