Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

Terratest

terratest.gruntwork.io

  • Free plan
  • Linux

What Terratest is

Terratest is an open-source Go library for writing automated tests for infrastructure code. Its helpers cover Terraform, OpenTofu, Terragrunt, Packer, Helm, Docker, and Kubernetes, as well as AWS, Azure, and GCP APIs. Tests can run infrastructure tools, deploy real resources, validate the resulting environment, and remove resources afterward. Checks can use HTTP requests, API calls, SSH connections, or shell commands. The documentation covers unit, integration, and end-to-end testing, along with parallel execution, retries, error handling, and static analysis. Terratest runs locally and includes provisioning tests, deployed checks, configuration compliance, and policy-as-code capabilities. It is released under the Apache 2.0 License and is free. The quick start requires Go version 1.26 or later, plus OpenTofu or Terraform for the examples. The documentation advises cleaning up after tests because they can create resources in real environments. Users can ask questions in GitHub Discussions or file issues; Gruntwork offers commercial support to companies relying on Terratest in production.

Who it suits

Terratest suits teams writing and validating infrastructure code with Go, including teams using Terraform, Packer, Docker, or Kubernetes. It is especially relevant when tests need to check deployed infrastructure in real environments.

Good to know, and what to watch

  • Supports Terraform, OpenTofu, Packer, Helm, and more.
  • Validates deployments through HTTP, APIs, SSH, or shell.
  • Covers unit, integration, and end-to-end tests.
  • Open source under the Apache 2.0 License.
  • Quick start requires Go 1.26 or later.
  • Examples require OpenTofu or Terraform.
  • Tests can deploy real resources that need cleanup.
  • The v1 line receives security fixes only.

Apache 2.0 open-source license

Free

Open source

Getting started

  1. Open the Terratest website
  2. Install Go version 1.26 or later
  3. Install OpenTofu or Terraform for the examples
  4. Add Terratest to a Go testing project
  5. Use Go’s testing framework to run infrastructure tests
  6. Clean up deployed resources after tests

The verdict

Terratest provides Go-based patterns for testing infrastructure code through deployment, validation, and cleanup. Teams should account for its Go requirement and clean up resources created by tests.

Questions people ask

Is Terratest free?

Yes. Terratest is free and released under the Apache 2.0 License.

What does Terratest support?

Its helpers support Terraform, OpenTofu, Terragrunt, Packer, Helm, Docker, Kubernetes, AWS, Azure, and GCP.

What do I need to start?

The quick start requires Go 1.26 or later and OpenTofu or Terraform for its examples.

Can Terratest check deployed infrastructure?

Yes. Tests can deploy real resources, validate them through HTTP, API, SSH, or shell checks, and undeploy them afterward.

Where can users get help?

Questions go to GitHub Discussions, while bugs and improvement requests go through GitHub Issues. Gruntwork offers commercial support for production users.

Does Terratest run in the cloud?

Its execution model is local, although tests can work with cloud APIs and real environments.

What the maker publishes

Cloud integrations
Its helpers include working with AWS, Azure, and GCP APIs. source
Cloud support
The site includes examples for AWS and GCP, and lists Azure support among its examples. source
Commercial support
Companies relying on Terratest in production can get commercial support directly from Gruntwork. source
Community support
Users can ask questions in GitHub Discussions and report bugs or request improvements through GitHub Issues. source
Founded
2016 source
Infrastructure tools
Terratest provides helpers for Terraform and OpenTofu, Packer, Docker, Kubernetes, and Helm. source
Intended users
Terratest is for teams testing infrastructure code, including code built with Terraform, Packer, Docker, and Kubernetes. source
License
The Terratest code is released under the Apache 2.0 License. source
Maker
The site identifies Terratest as built by Gruntwork. source
Maker founding
Gruntwork says the two companies that became Gruntwork merged in 2016. source
Open source
Terratest is an open source project, and its code is released under the Apache 2.0 License. source
Other helpers
The library includes helpers for SSH commands, HTTP requests, and shell commands. source
Purpose
Terratest is a Go library with patterns and helper functions for testing infrastructure code. source
Requirements
The quick start requires Go version 1.26 or later and OpenTofu or Terraform for its examples. source
Requirements
Terratest requires Go 1.26 or later; its Terraform helpers can use either the Terraform or OpenTofu binary. source
Resource cleanup
The documentation recommends cleaning up after tests because Terratest can deploy real resources into real environments. source
Support
Users can ask general questions in GitHub Discussions, report bugs or request improvements through GitHub Issues, and obtain commercial support from Gruntwork. source
Supported tools
The site lists first-class support for Terraform, Packer, Docker, Kubernetes, AWS, GCP, and more. source
Testing workflow
Tests can deploy real infrastructure, validate it with HTTP requests, API calls, or SSH connections, and undeploy it at the end. source
Test types
The documentation covers unit, integration, and end-to-end testing, as well as parallelism, retries, error handling, and static analysis. source
Test workflow
Terratest tests use Go’s testing framework to run infrastructure tools, validate deployed infrastructure, and undeploy it at the end. source
Validation
Built-in tools can validate infrastructure by making HTTP requests, API calls, and SSH connections. source
Version maintenance
The v1 line receives security fixes only while v2 is in development. source
What it does
Terratest is a Go library for writing automated tests for infrastructure code. source

Checked against the maker's pages on 3 Oct 2026.