- Home
- Infrastructure Testing Tools
- Terratest
Terratest
What it is
Terratest is an open-source Go library for writing automated tests for infrastructure code. It provides patterns and helpers for tools such as Terraform, OpenTofu, Terragrunt, Packer, Helm, Docker and Kubernetes, plus integrations with AWS, Azure and GCP. Tests can run infrastructure tools, deploy resources, check the resulting environment, then remove what they created. Validation can use HTTP requests, API calls, SSH connections or shell commands. Documentation covers unit, integration and end-to-end testing, as well as parallel execution, retries, error handling and static analysis. Terratest runs locally and includes configuration-compliance, provisioning, deployed-check and policy-as-code capabilities. It is free under the Apache 2.0 License. The quick start calls for Go 1.26 or later and OpenTofu or Terraform for its examples. Users can ask questions in GitHub Discussions or submit issues; Gruntwork offers commercial support to companies using it in production. The documentation advises cleaning up after tests because they can create resources in real environments. The v1 line receives security fixes only while v2 is in development.
For and against
For
- Free and released under the Apache 2.0 License
- Helpers cover infrastructure tools and cloud APIs
- Supports unit, integration and end-to-end testing
- Validation includes HTTP, API and SSH checks
- Offers community and commercial support
Against
- Quick start requires Go 1.26 or later
- Tests can deploy real resources requiring cleanup
- The v1 line receives security fixes only
The verdict
Terratest brings infrastructure deployment and validation into Go tests, with support for a wide range of tools and checks. Teams should account for its Go requirement and clean up resources created by tests.
Who it suits
Terratest suits teams that want to automate checks for infrastructure code built with tools such as Terraform, Packer, Docker or Kubernetes. It assumes familiarity with Go and, for the quick-start examples, Go 1.26 or later.
Plans and prices
Apache 2.0 open-source license
Go 1.26 or later · infrastructure testing library
Read 3 Oct 2026 · github.com
On the record
- Cloud integrations
- Its helpers include working with AWS, Azure, and GCP APIs.github.com · read 3 Oct 2026
- Cloud support
- The site includes examples for AWS and GCP, and lists Azure support among its examples.terratest.gruntwork.io · read 2 Oct 2026
- Commercial support
- Companies relying on Terratest in production can get commercial support directly from Gruntwork.terratest.gruntwork.io · read 2 Oct 2026
- Community support
- Users can ask questions in GitHub Discussions and report bugs or request improvements through GitHub Issues.terratest.gruntwork.io · read 2 Oct 2026
- Infrastructure tools
- Terratest provides helpers for Terraform and OpenTofu, Packer, Docker, Kubernetes, and Helm.github.com · read 3 Oct 2026
- Intended users
- Terratest is for teams testing infrastructure code, including code built with Terraform, Packer, Docker, and Kubernetes.terratest.gruntwork.io · read 3 Oct 2026
- License
- The Terratest code is released under the Apache 2.0 License.github.com · read 3 Oct 2026
- Maker
- The site identifies Terratest as built by Gruntwork.terratest.gruntwork.io · read 2 Oct 2026
- Maker founding
- Gruntwork says the two companies that became Gruntwork merged in 2016.gruntwork.io · read 2 Oct 2026
- Open source
- Terratest is an open source project, and its code is released under the Apache 2.0 License.terratest.gruntwork.io · read 2 Oct 2026
- Other helpers
- The library includes helpers for SSH commands, HTTP requests, and shell commands.github.com · read 3 Oct 2026
- Purpose
- Terratest is a Go library with patterns and helper functions for testing infrastructure code.terratest.gruntwork.io · read 2 Oct 2026
- Requirements
- Terratest requires Go 1.26 or later; its Terraform helpers can use either the Terraform or OpenTofu binary.terratest.gruntwork.io · read 3 Oct 2026
- Resource cleanup
- The documentation recommends cleaning up after tests because Terratest can deploy real resources into real environments.terratest.gruntwork.io · read 2 Oct 2026
- Support
- Users can ask general questions in GitHub Discussions, report bugs or request improvements through GitHub Issues, and obtain commercial support from Gruntwork.terratest.gruntwork.io · read 3 Oct 2026
- Supported tools
- The site lists first-class support for Terraform, Packer, Docker, Kubernetes, AWS, GCP, and more.terratest.gruntwork.io · read 2 Oct 2026
- Testing workflow
- Tests can deploy real infrastructure, validate it with HTTP requests, API calls, or SSH connections, and undeploy it at the end.terratest.gruntwork.io · read 3 Oct 2026
- Test types
- The documentation covers unit, integration, and end-to-end testing, as well as parallelism, retries, error handling, and static analysis.terratest.gruntwork.io · read 2 Oct 2026
The review
Terratest is a Go library for automating tests of infrastructure code, best suited to teams already using Go alongside tools such as Terraform, Packer, or Kubernetes. Its defining strength is checking deployed infrastructure as part of a test workflow; teams must plan for Go compatibility and resource cleanup.
Overview
Terratest gives Go tests helpers to run infrastructure tools, validate what they deploy, and tear it down. That makes it a strong fit when infrastructure changes need checks against working environments, not just configuration review. The project is built by Gruntwork and released under the Apache 2.0 License. Questions and bug reports can go through GitHub Discussions and Issues, and Gruntwork offers commercial support to companies relying on Terratest in production.
Key features
Tests use Go’s testing framework to deploy infrastructure, check it, then undeploy it. Built-in helpers make HTTP requests, call APIs, connect over SSH, and run shell commands. These checks can cover behavior in a running environment, which is useful for integration and end-to-end coverage. The trade-off is operational: tests can create real resources in real environments, so cleanup must be part of the workflow.
Helpers support Terraform, OpenTofu, Terragrunt, Packer, Docker, Kubernetes, and Helm, as well as AWS, Azure, and GCP APIs. Documentation covers unit, integration, and end-to-end tests, plus parallelism, retries, error handling, and static analysis. This breadth suits teams with several infrastructure tools; the quick start requires Go 1.26 or later and OpenTofu or Terraform for its examples, so it is a poor fit for teams unable or unwilling to adopt that Go baseline.
Terratest also supports configuration compliance, provisioning tests, deployed checks, and policy as code, with local execution. Its v1 line receives security fixes only while v2 is in development, a maintenance constraint teams should weigh when choosing a version for ongoing production work.
Pricing
Terratest is free and open source under Apache 2.0. The Apache 2.0 open-source plan costs nothing and requires Go 1.26 or later. There is no paid plan to unlock its infrastructure testing library; production teams that want commercial support can obtain it directly from Gruntwork.
Platforms
Terratest is listed for Linux, and its execution model is local. Teams should ensure their development and CI environments match that platform requirement.
Who it's for
Terratest is aimed at teams that write infrastructure code and want automated checks against deployed systems, especially those already working in Go and across Terraform, Packer, Docker, Kubernetes, or cloud APIs. It is less suitable for teams seeking a standalone graphical testing product or a workflow that avoids Go and real-resource cleanup.
Pros and cons
- Pro: Tests can exercise real deployments and validate them through HTTP, API, and SSH checks, giving teams a path beyond static inspection.
- Pro: Helpers span multiple infrastructure tools and AWS, Azure, and GCP APIs, which can consolidate testing across a mixed stack.
- Pro: The Apache 2.0 license makes the library free to use, with community channels and a commercial support option.
- Con: Go 1.26 or later is required by the quick start, adding a language and version constraint for teams that do not already use Go.
- Con: Tests may create real resources, making reliable teardown an essential part of test operations.
- Con: The v1 line receives security fixes only while v2 is in development, which limits the maintenance scope for v1 users.
Alternatives
For a different infrastructure-testing option, see Infrastructure Testing Tools. Consider these free alternatives when their stated platforms or package focus better match your environment:
- Conftest is a free, Apache 2.0-licensed option available on Linux, macOS, and Windows.
- cfn-lint is a free MIT-0-licensed option supporting Python 3.10–3.14 and Linux, macOS, Windows, or self-hosted use.
- Cinc Auditor is a free distribution of Chef InSpec for Linux, macOS, and Windows, with no formal warranties or support.
- kube-score is a free, MIT-licensed tool available on Linux, macOS, Windows, self-hosted, and web platforms.
- kubeconform is free on Linux, macOS, Windows, and self-hosted platforms.
- Serverspec is a free open-source Ruby gem maintained by Gosuke Miyashita.
- terraform-plugin-testing is a free Go module for Terraform provider testing, available on Linux and macOS.
- Test Kitchen is a free, Apache 2.0-licensed option for Linux, macOS, and Windows.
Verdict
Choose Terratest if your team uses Go and needs automated tests that can deploy infrastructure, check its real behavior, and clean it up. Its broad tool and cloud helpers make it a practical fit for infrastructure code spanning several systems. Look elsewhere if Go 1.26 or later is a barrier, or if your workflow cannot safely manage resources created during tests.