terraform-test

Write and run Terraform module tests using .tftest.hcl files.

5|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/agentdevsl/agentpane --skill terraform-test-agentdevsl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-test
Source: https://github.com/agentdevsl/agentpane/tree/main/.claude/skills/terraform-test
Command: npx skills add https://github.com/agentdevsl/agentpane --skill terraform-test-agentdevsl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraform module authors often need to validate configuration updates without risking real infrastructure. This Skill provides a complete framework to author, run, and validate tests for Terraform modules using Terraform's built-in test framework.

Core Features & Use Cases

  • Test File Essentials: Works with .tftest.hcl or .tftest.json files containing run blocks, variables, and assertions.
  • Plan vs Apply: Supports unit tests in plan mode and integration tests in apply mode to balance speed and realism.
  • Mock Providers & Module Testing: Enables testing with mock providers and testing both local and registry modules to ensure reliability across environments.
  • CI/CD Readiness: Integrates into pipelines to catch regressions in Terraform configurations before deployment.

Quick Start

Create a tests/ directory with a file like tests/defaults_unit_test.tftest.hcl that demonstrates a simple plan-mode test. Then run terraform test to execute the suite. You can reference outputs from previous runs and use multiple modules to structure tests.

Frequently Asked Questions about terraform-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate Terraform modules without deploying real infrastructure?

You can validate Terraform modules without deploying real resources by using the built-in Terraform test framework with mock providers. Write .tftest.hcl files using plan mode to safely verify configuration behavior.

How do I write and run unit tests for Terraform configurations?

Write unit tests for Terraform by creating a tests/ directory with .tftest.hcl or .tftest.json files containing run blocks and assertions. Execute the suite by running the terraform test command.

What is the difference between plan and apply mode in Terraform testing?

Plan mode runs fast unit tests by evaluating configuration logic without creating resources, while apply mode executes integration tests that provision real infrastructure to balance speed and realism.

Can I use mock providers to test local and registry Terraform modules?

Yes, you can use mock providers to test both local and registry Terraform modules. This ensures reliability across environments by verifying infrastructure behavior without deploying real resources.

How do I structure Terraform test files to catch regressions in CI/CD pipelines?

Structure Terraform test files using run blocks, variables, and assertions to validate outputs from previous runs. Integrating the terraform test command into CI/CD pipelines catches configuration regressions before deployment.