This folder contains a very simple Packer template to demonstrate how you can use Terratest to write automated tests
for your Packer templates. The template just creates an up-to-date Ubuntu AMI by running apt-get update and
apt-get upgrade.
Check out test/packer_basic_example_test.go to see how you can write automated tests for this simple template.
Note that this template doesn't do anything useful; it's just here to demonstrate the simplest usage pattern for Terratest. For slightly more complicated, real-world examples of Packer templates and the corresponding tests, see packer-docker-example and terraform-packer-example.
- Sign up for AWS.
- Configure your AWS credentials using one of the supported methods for AWS CLI
tools, such as setting the
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYenvironment variables. - Install Packer and make sure it's on your
PATH. - Run
packer build build.json.
- Sign up for AWS.
- Configure your AWS credentials using one of the supported methods for AWS CLI
tools, such as setting the
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYenvironment variables. - Install Packer and make sure it's on your
PATH. - Install Golang and make sure this code is checked out into your
GOPATH. cd testdep ensurego test -v -run TestPackerBasicExample
- Sign up for GCP.
- Configure your GCP credentials using one of the Authentication methods.
- Install Packer and make sure it's on your
PATH. - Install Golang and make sure this code is checked out into your
GOPATH. cd testdep ensurego test -v -run TestPackerGCPBasicExample
- Sign up for OCI.
- Configure your OCI credentials via CLI Configuration Information.
- Create VCN and subnet resources in your tenancy (a.k.a. a root compartment).
- (Optional) Create
TF_VAR_pass_phraseenvironment property with the pass phrase for decrypting of the OCI API signing key (can be omitted if the key is not protected). - Install Packer and make sure it's on your
PATH. - Install Golang and make sure this code is checked out into your
GOPATH. cd testdep ensurego test -v -run TestPackerOciExample