# gruntwork-io/terratest

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/gruntwork-io-terratest).**

7,879 stars · 1,372 forks · Go · apache-2.0

## Links

- GitHub: https://github.com/gruntwork-io/terratest
- Homepage: https://terratest.gruntwork.io/
- awesome-repositories: https://awesome-repositories.com/repository/gruntwork-io-terratest.md

## Topics

`aws` `devops` `docker` `golang` `packer` `terraform` `testing` `testing-library`

## Description

Terratest is a Go library and testing framework designed for automating the deployment, validation, and destruction of infrastructure stacks. It serves as a cloud resource verification tool that interacts with provider APIs and executes remote shell commands to ensure infrastructure definitions are correctly configured.

The framework provides specialized support for validating Terraform modules and Kubernetes deployments, including the verification of container orchestration manifests and Helm charts. It distinguishes itself through the use of Docker container utilities for script execution and tool isolation, as well as the ability to verify the internal state of containers and remote systems via SSH.

The project covers a broad range of validation primitives, including deployment idempotency checks, HTTP endpoint verification with retry logic, and automated resource cleanup to prevent cost sprawl. It also handles operational concerns such as parallel test log de-interleaving, resource identifier namespacing to prevent collisions, and policy compliance auditing.

Terratest integrates with Maven builds and supports library version pinning to ensure reproducible test environments.

## Tags

### Testing & Quality Assurance

- [Automated Infrastructure Testing](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/automated-infrastructure-testing.md) — Automates the deployment, validation, and destruction of Terraform modules to ensure cloud resources are correctly configured.
- [Terraform Testing Frameworks](https://awesome-repositories.com/f/testing-quality-assurance/terraform-testing-frameworks.md) — Provides a specialized Go library for automating the deployment, validation, and destruction of Terraform infrastructure stacks.
- [API Endpoint Testing](https://awesome-repositories.com/f/testing-quality-assurance/api-endpoint-testing.md) — Retrieves Kubernetes service endpoints to verify application availability via programmatic API calls. ([source](https://terratest.gruntwork.io/docs/getting-started/quick-start/))
- [Cloud Resource Verification Libraries](https://awesome-repositories.com/f/testing-quality-assurance/cloud-resource-verification-libraries.md) — Provides a comprehensive suite of helpers for validating deployed services across multiple cloud platforms.
- [Cloud State Verifications](https://awesome-repositories.com/f/testing-quality-assurance/cloud-state-verifications.md) — Provides utilities to interact directly with cloud provider APIs to verify the actual state of deployed resources.
- [Go Testing Frameworks](https://awesome-repositories.com/f/testing-quality-assurance/go-testing-frameworks.md) — Implements a testing framework specifically for infrastructure using the Go programming language.
- [Infrastructure Testing Tools](https://awesome-repositories.com/f/testing-quality-assurance/testing-infrastructure-management/infrastructure-testing-tools.md) — Provides a framework for verifying the configuration, deployment, and operational state of cloud infrastructure.
- [Cloud Service Mocks](https://awesome-repositories.com/f/testing-quality-assurance/cloud-service-mocks.md) — Injects mock cloud clients and context to enable unit testing without requiring live provider APIs. ([source](https://terratest.gruntwork.io/docs/migrating-to-v1/azure/))
- [Test Lifecycle and Execution Control](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/test-lifecycle-execution-control.md) — Manages the full sequence of initialization, deployment, and destruction around each test case.
- [Infrastructure Unit Tests](https://awesome-repositories.com/f/testing-quality-assurance/unit-testing-frameworks/infrastructure-unit-tests.md) — Executes lifecycle commands against individual infrastructure modules to verify their specific configuration and deployment. ([source](https://terratest.gruntwork.io/docs/getting-started/testing-terragrunt/))

### Development Tools & Productivity

- [Deployment Resource Cleanup](https://awesome-repositories.com/f/development-tools-productivity/application-installers/deployment-resource-cleanup.md) — Automates the complete removal of cloud resources created during tests to prevent cost sprawl. ([source](https://terratest.gruntwork.io/docs/))

### DevOps & Infrastructure

- [State Verification](https://awesome-repositories.com/f/devops-infrastructure/cloud-infrastructure/cloud-computing-serverless/cloud-orchestration-automation/cloud-resource-api-management/state-verification.md) — Interacts directly with cloud provider APIs to verify that deployed resources are correctly configured. ([source](https://terratest.gruntwork.io/docs/getting-started/godoc/))
- [Cloud Service Integrations](https://awesome-repositories.com/f/devops-infrastructure/cloud-service-integrations.md) — Uses cloud APIs to verify the operational state and configuration of deployed cloud services. ([source](https://terratest.gruntwork.io/docs/getting-started/introduction/))
- [Deployment Validation](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration-deployment/deployment-validation.md) — Validates images, APIs, and Helm charts to ensure containerized applications deploy and run correctly. ([source](https://terratest.gruntwork.io/docs/getting-started/godoc/))
- [Automated Quality Assurance Suites](https://awesome-repositories.com/f/devops-infrastructure/continuous-integration/automated-quality-assurance-suites.md) — Provides automated test suites and idempotency checks to ensure infrastructure definitions are reproducible and error-free.
- [Endpoint Verification](https://awesome-repositories.com/f/devops-infrastructure/devops/operational-reliability/automated-service-reliability/endpoint-verification.md) — Performs HTTP requests with retry logic to confirm that deployed services return the expected responses. ([source](https://terratest.gruntwork.io/docs/getting-started/quick-start))
- [SSH-Based Remote Execution](https://awesome-repositories.com/f/devops-infrastructure/execution-environments/remote-workspace-command-execution/ssh-based-remote-execution.md) — Runs shell commands and scripts on remote instances via SSH to validate internal system state and health.
- [Behavioral Validation](https://awesome-repositories.com/f/devops-infrastructure/infrastructure-deployment/behavioral-validation.md) — Runs deployment commands and verifies that the resulting infrastructure behaves as expected. ([source](https://terratest.gruntwork.io/))
- [Infrastructure Lifecycle Management](https://awesome-repositories.com/f/devops-infrastructure/infrastructure-lifecycle-management.md) — Automates the full cycle of creating, testing, and cleaning up temporary environments to prevent resource sprawl.
- [Manifest Validation](https://awesome-repositories.com/f/devops-infrastructure/kubernetes-deployments/kubernetes-application-deployments/manifest-validation.md) — Applies and deletes Kubernetes manifests to verify service availability and endpoint responses. ([source](https://terratest.gruntwork.io/docs/getting-started/quick-start))
- [Remote Command Execution](https://awesome-repositories.com/f/devops-infrastructure/remote-command-execution.md) — Executes shell commands and scripts via SSH on remote servers to verify application functionality and system state.
- [Multi-Cloud Validation](https://awesome-repositories.com/f/devops-infrastructure/cloud-deployment/multi-cloud-deployments/multi-cloud-validation.md) — Verifies that infrastructure configurations deploy correctly across various cloud providers using automated tests. ([source](https://terratest.gruntwork.io/docs/))
- [State Polling](https://awesome-repositories.com/f/devops-infrastructure/cloud-infrastructure-management/resource-state-modeling/state-polling.md) — Implements polling logic with configurable timeouts to verify that asynchronous cloud deployments reach a healthy state.
- [Automated Testing Containers](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/container-runtimes/runtime-configuration-interfaces/docker-socket-orchestrators/docker-target-configurators/docker-container-deployments/docker-container-execution/automated-testing-containers.md) — Builds and runs container images to verify the internal state and configuration of application containers.
- [Test Script Execution](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/container-runtimes/runtime-configuration-interfaces/docker-socket-orchestrators/docker-target-configurators/docker-container-deployments/docker-container-execution/test-script-execution.md) — Runs scripts inside Docker containers to accelerate iteration by reducing build and startup times. ([source](https://terratest.gruntwork.io/docs/testing-best-practices/iterating-locally-using-docker/))
- [Configuration Validation](https://awesome-repositories.com/f/devops-infrastructure/containerization/image-inspection/container-image-analyzers/configuration-validation.md) — Tests container images and templates to ensure artifacts are built and deployed correctly. ([source](https://terratest.gruntwork.io/docs/getting-started/introduction/))
- [Infrastructure Output Variables](https://awesome-repositories.com/f/devops-infrastructure/infrastructure/infrastructure-as-code/iac-language-constructs/infrastructure-output-variables.md) — Extracts output variables from deployed stacks to verify resource attributes and configurations. ([source](https://terratest.gruntwork.io/docs/getting-started/testing-terragrunt/))
- [Deployment Validations](https://awesome-repositories.com/f/devops-infrastructure/kubernetes-deployments/deployment-validations.md) — Tests container orchestration manifests and Helm charts to verify that services are available and responding.
- [Deployment Validators](https://awesome-repositories.com/f/devops-infrastructure/kubernetes-deployments/deployment-validators.md) — Applies manifests and verifies service availability and endpoint responses within Kubernetes clusters.

### Software Engineering & Architecture

- [Infrastructure Idempotency Testing](https://awesome-repositories.com/f/software-engineering-architecture/idempotency-patterns/infrastructure-idempotency-testing.md) — Applies configurations multiple times to ensure a consistent state without creating unexpected changes. ([source](https://terratest.gruntwork.io/docs/))
- [Container-Based Isolation](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/modular-decoupled-design/decoupled-architectures/container-based-isolation.md) — Uses Docker containers to isolate tooling and ensure consistent execution environments for infrastructure tests.

### Security & Cryptography

- [Audit and Compliance](https://awesome-repositories.com/f/security-cryptography/governance-policy-frameworks/compliance-governance/audit-and-compliance.md) — Checks infrastructure configurations against defined rules to verify adherence to security and operational policies. ([source](https://terratest.gruntwork.io/docs/getting-started/introduction/))

### Part of an Awesome List

- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — Go library for automated infrastructure testing.
