Terratest

The ultimate testing library for infrastructure code.

Visit Website →

Overview

Terratest is an open-source Go library for writing automated tests for your infrastructure code. It's not a scanner, but a testing framework. With Terratest, you can write tests to provision real infrastructure using tools like Terraform or Packer, validate that the infrastructure works correctly, and then tear it all down. It's primarily used for integration and end-to-end testing of IaC.

✨ Key Features

  • Write tests for IaC in Go
  • Orchestrate `terraform apply` and `terraform destroy`
  • Helper functions for SSH, HTTP requests, and cloud provider APIs (AWS, Azure, GCP)
  • Test Terraform modules, Packer templates, and Docker images
  • Enables integration and end-to-end testing

🎯 Key Differentiators

  • Uses a general-purpose programming language (Go) for maximum flexibility.
  • Extensive library of helper functions for common testing tasks.
  • Strong community and maintained by Gruntwork.

Unique Value: Provides a true integration testing framework for IaC, giving you confidence that your code works in a real-world environment.

🎯 Use Cases (4)

Integration testing of Terraform modules End-to-end testing of infrastructure deployments Validating that infrastructure is configured correctly after deployment Creating a test pipeline for reusable infrastructure modules

✅ Best For

  • Writing automated Go tests to deploy a Terraform module, verify its outputs and state, and then destroy the created infrastructure.

💡 Check With Vendor

Verify these considerations match your specific requirements:

  • Static analysis and linting (Terratest deploys real resources)
  • Users who do not want to write code in Go

🏆 Alternatives

Kitchen-Terraform InSpec

Unlike static analysis tools that only check code, Terratest deploys and validates live infrastructure, catching a different class of errors.

💻 Platforms

Desktop

🔌 Integrations

Terraform Packer Docker Kubernetes Go testing framework

💰 Pricing

Contact for pricing
Free Tier Available

Free tier: Terratest is completely free and open-source.

Visit Terratest Website →