terraform-test
Enables creation and execution of Terraform tests using `.tftest.hcl` files to validate infrastructure behavior without deploying resources.
Install
mkdir -p .claude/skills/terraform-test && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5157" && unzip -o skill.zip -d .claude/skills/terraform-test && rm skill.zipInstalls to .claude/skills/terraform-test
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating infrastructure behavior with assertions, mocking providers and data sources, testing module outputs and resource configurations, or troubleshooting Terraform test syntax and execution.Key capabilities
- →Generates.tftest.hcl test files
- →Configures run blocks for validation
- →Mocks provider behavior for testing
- →Filters tests between plan and apply modes
How it works
Constructs test scenarios in.tftest.hcl files that execute either plan-mode checks (no resources) or apply-mode checks (real resources).
Inputs & outputs
When to use terraform-test
- →Writing infrastructure unit tests
- →Mocking providers for testing
- →Validating module outputs
- →Setting up CI/CD test pipelines
About terraform-test
Provides instructions on using run blocks, assert blocks, and mock providers to test Terraform modules. It ensures configuration changes do not break infrastructure.
Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating infrastructure behavior with assertions, mocking providers and data sources, testing module outputs and resource configurations, or troubleshooting Terraform test syntax and execution.
When not to use it
- →When working with Terraform versions below 1.7.0 for mocks
- →For temporary configurations that will not be maintained
Prerequisites
Limitations
- →Apply-mode tests create real infrastructure, incurring costs
- →Requires explicit knowledge of Terraform test syntax
How it compares
Utilizes the native testing framework for infrastructure safety rather than external testing scripts.
Compared to similar skills
terraform-test side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| terraform-test (this skill) | 1 | 4mo | Review | Intermediate |
| senior-devops | 7 | 7mo | Review | Advanced |
| devops-iac-engineer | 2 | 7mo | Review | Advanced |
| run-acceptance-tests | 2 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by hashicorp
View all by hashicorp →You might also like
senior-devops
davila7
Comprehensive DevOps skill for CI/CD, infrastructure automation, containerization, and cloud platforms (AWS, GCP, Azure). Includes pipeline setup, infrastructure as code, deployment automation, and monitoring. Use when setting up pipelines, deploying applications, managing infrastructure, implementing monitoring, or optimizing deployment processes.
devops-iac-engineer
davila7
Implements infrastructure as code using Terraform, Kubernetes, and cloud platforms. Designs scalable architectures, CI/CD pipelines, and observability solutions. Provides security-first DevOps practices and site reliability engineering guidance.
run-acceptance-tests
hashicorp
Guide for running acceptance tests for a Terraform provider. Use this when asked to run an acceptance test or to run a test with the prefix `TestAcc`.
devops-engineer
Jeffallan
Use when setting up CI/CD pipelines, containerizing applications, or managing infrastructure as code. Invoke for pipelines, Docker, Kubernetes, cloud platforms, GitOps.
terraform-specialist
sickn33
Expert Terraform/OpenTofu specialist mastering advanced IaC automation, state management, and enterprise infrastructure patterns. Handles complex module design, multi-cloud deployments, GitOps workflows, policy as code, and CI/CD integration. Covers migration strategies, security best practices, and modern IaC ecosystems. Use PROACTIVELY for advanced IaC, state management, or infrastructure automation.
onboarding
ColeMurray
Deploy your own Open-Inspect instance. Use when the user wants to set up, deploy, or onboard to Open-Inspect. Guides through repository setup, credential collection, Terraform deployment, and verification with user handoffs.