Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 1.28 KB

File metadata and controls

33 lines (20 loc) · 1.28 KB

Terraform Basic Example

This folder contains a very simple Terraform module to demonstrate how you can use Terratest to write automated tests for your Terraform code. This module takes in an input variable called example, renders it using a template_file data source, and outputs the result in an output variable called example.

Check out test/terraform_basic_example_test.go to see how you can write automated tests for this simple module.

Note that this module doesn't do anything useful; it's just here to demonstrate the simplest usage pattern for Terratest. For a slightly more complicated, real-world example of a Terraform module and the corresponding tests, see terraform-aws-example.

Running this module manually

  1. Install Terraform and make sure it's on your PATH.
  2. Run terraform init.
  3. Run terraform apply.
  4. When you're done, run terraform destroy.

Running automated tests against this module

  1. Install Terraform and make sure it's on your PATH.
  2. Install Golang and make sure this code is checked out into your GOPATH.
  3. cd test
  4. dep ensure
  5. go test -v -run TestTerraformBasicExample