terratest

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: Apache-2.0

README

Terratest

Maintained by Gruntwork.io Go Report Card go.dev reference go.mod version

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code. It provides a variety of helper functions and patterns for common infrastructure testing tasks, including:

  • Testing Terraform code
  • Testing Packer templates
  • Testing Docker images
  • Executing commands on servers over SSH
  • Working with AWS APIs
  • Working with Azure APIs
  • Working with GCP APIs
  • Working with Kubernetes APIs
  • Testing Helm Charts
  • Making HTTP requests
  • Running shell commands
  • And much more

Install

go get github.com/gruntwork-io/terratest@latest

Requires Go 1.26 or later. To lock to a specific release instead of @latest, see Pinning a Terratest version.

Stability and versioning

Starting with v1.0.0, Terratest follows semantic versioning. Breaking changes to the public API only happen in major releases (e.g. v2.0.0).

Symbols renamed or replaced in v1 are kept with // Deprecated: annotations pointing at the new name; removals happen in v2. Migrating from v0.x: see the v1 migration guide.

More info

License

This code is released under the Apache 2.0 License. Please see LICENSE and NOTICE for more details.

Copyright © 2025 Gruntwork, Inc.

Directories

Path Synopsis
cmd
examples
internal
lib/formatting
Package formatting provides internal utilities for formatting Terraform/Terragrunt CLI arguments.
Package formatting provides internal utilities for formatting Terraform/Terragrunt CLI arguments.
modules
aws
Package aws allows to interact with resources on Amazon Web Services.
Package aws allows to interact with resources on Amazon Web Services.
azure
Package azure allows users to interact with resources on the Microsoft Azure platform.
Package azure allows users to interact with resources on the Microsoft Azure platform.
collections
Package collections allows to interact with lists of things.
Package collections allows to interact with lists of things.
database
Package database provides helper functions to connect to and interact with databases during automated tests.
Package database provides helper functions to connect to and interact with databases during automated tests.
dns-helper
Package dns_helper contains helpers to interact with the Domain Name System.
Package dns_helper contains helpers to interact with the Domain Name System.
docker
Package docker allows to interact with Docker and docker compose resources.
Package docker allows to interact with Docker and docker compose resources.
environment
Package environment provides utility functions for interacting with the OS environment (e.g environment variables).
Package environment provides utility functions for interacting with the OS environment (e.g environment variables).
files
Package files allows to interact with files on a file system.
Package files allows to interact with files on a file system.
gcp
Package gcp allows interaction with Google Cloud Platform resources.
Package gcp allows interaction with Google Cloud Platform resources.
git
Package git allows to interact with Git.
Package git allows to interact with Git.
helm
Package helm provides common functionalities for testing helm charts, such as calling out to the helm client.
Package helm provides common functionalities for testing helm charts, such as calling out to the helm client.
http-helper
Package http_helper contains helpers to interact with deployed resources through HTTP.
Package http_helper contains helpers to interact with deployed resources through HTTP.
k8s
Package k8s provides common functionalities for interacting with a Kubernetes cluster in the context of infrastructure testing.
Package k8s provides common functionalities for interacting with a Kubernetes cluster in the context of infrastructure testing.
logger
Package logger contains different methods to log.
Package logger contains different methods to log.
logger/parser
Package parser contains methods to parse and restructure log output from go testing and terratest.
Package parser contains methods to parse and restructure log output from go testing and terratest.
oci
Package oci allows you to interact with Oracle Cloud Infrastructure (OCI) resources.
Package oci allows you to interact with Oracle Cloud Infrastructure (OCI) resources.
opa
Package opa provides helpers for running Open Policy Agent (OPA) evaluations in automated tests.
Package opa provides helpers for running Open Policy Agent (OPA) evaluations in automated tests.
packer
Package packer allows to interact with Packer.
Package packer allows to interact with Packer.
random
Package random contains different random generators.
Package random contains different random generators.
retry
Package retry contains logic to retry actions with certain conditions.
Package retry contains logic to retry actions with certain conditions.
shell
Package shell allows to run commands in a shell.
Package shell allows to run commands in a shell.
slack
Package slack contains routines useful for testing slack integrations.
Package slack contains routines useful for testing slack integrations.
ssh
Package ssh allows to manage SSH connections and send commands through them.
Package ssh allows to manage SSH connections and send commands through them.
terraform
Package terraform allows to interact with Terraform.
Package terraform allows to interact with Terraform.
terragrunt
Package terragrunt provides test helpers for running Terragrunt commands.
Package terragrunt provides test helpers for running Terragrunt commands.
test-structure
Package test_structure provides helpers for structuring Terraform tests into stages.
Package test_structure provides helpers for structuring Terraform tests into stages.
testing
Package testing provides the TestingT interface used throughout Terratest.
Package testing provides the TestingT interface used throughout Terratest.
version-checker
Package version_checker provides utilities for checking binary versions against constraints.
Package version_checker provides utilities for checking binary versions against constraints.
formatting module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL