Setup & Installation
What This Skill Does
Terraform's built-in testing framework for writing and running tests against Terraform configurations. Tests use .tftest.hcl files with run blocks, assert conditions, and optional mock providers to validate module behavior without relying on external test tools.
Unlike third-party tools like Terratest, terraform test runs natively with no extra binaries, supports mock providers to avoid cloud costs, and integrates directly into existing CI workflows with a single command.
When to use it
- Writing .tftest.hcl files to validate module outputs before merging changes
- Running plan-mode unit tests locally without provisioning real cloud resources
- Mocking AWS or Azure providers to test conditional logic without credentials
- Catching variable validation regressions using expect_failures in CI pipelines
- Testing for_each resource counts and tag propagation across multiple run blocks