Contains packer configurations
-
Have the following folder structure for each project:
project_folder: - scripts/script_<purpose>.sh - ansible/playbook.yaml - builder.pkr.hcl - plugins.pkr.hcl - sources.pkr.hcl - variables.pkr.hcl
-
Requirements:
- Make sure to declare the
AWS_REGION
enviroment variable before continuing.
- Make sure to declare the
-
If developing locally then run the following commands to ensure the required plugins are installed (see the
packer
block on theplugins.pkr.hcl
file whithin the project folder):cd <project_name>
packer init plugins.pkr.hcl
-
Always set the value if the
SKIP_CREATE_AMI
environment variable totrue
before runningvalidate
andbuild
, once the test goes ok set the value tofalse
-
Use the
-debug
flag in case you need to inspect each step.
- Init and Verify
time packer init .
time packer fmt .
export SKIP_CREATE_AMI=true && packer validate -var aws_region=${AWS_REGION} .
time packer validate .
- Build:
export SKIP_CREATE_AMI=false && time packer build .