Why test infrastructure code
The deploy-assert-destroy idea.
Terratest is a Go library for testing infrastructure code the way it actually behaves: by deploying it for real, asserting on the result, and tearing it down. Static analysis (Checkov) tells you a manifest looks right; Terratest tells you the infrastructure works — the server actually responds, the module really creates a usable VPC, the Helm chart brings up a healthy service. It is integration testing for IaC, and it catches the class of bugs that only appear when code meets a real cloud.
The pattern is always the same three phases: deploy (apply the Terraform, install the chart), validate (make real assertions — hit the endpoint, query the API, check the output), and destroy (clean up everything). Because it uses real infrastructure, it is slower and costs money, so it sits at the top of the testing pyramid — fewer, higher-value tests than the fast static checks — but it is the only thing that proves the infrastructure genuinely functions.
Why real deploys
Some things simply cannot be checked without deploying: does the load balancer actually route to healthy backends, does the IAM role really let the app read that bucket, does the module compose correctly with its dependencies, does an upgrade path work. These are behavioral, integration-level questions. Terratest answers them by exercising the real thing in a throwaway environment, giving you confidence a static scan cannot.