Skip to content

Latest commit

 

History

History
 
 

packer-basic-example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Packer Basic Example

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.

Building the Packer template manually

  1. Sign up for AWS.
  2. Configure your AWS credentials using one of the supported methods for AWS CLI tools, such as setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
  3. Install Packer and make sure it's on your PATH.
  4. Run packer build build.json.

Running automated tests against this Packer template

  1. Sign up for AWS.
  2. Configure your AWS credentials using one of the supported methods for AWS CLI tools, such as setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
  3. Install Packer and make sure it's on your PATH.
  4. Install Golang and make sure this code is checked out into your GOPATH.
  5. cd test
  6. dep ensure
  7. go test -v -run TestPackerBasicExample