terraform-test

Run unit and integration tests against Terraform modules.

9|Updated Mar 27, 2023
One-click install
npx skills add https://github.com/blinqas/station --skill terraform-test-blinqas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-test
Source: https://github.com/blinqas/station/tree/main/.agents/skills/terraform-test
Command: npx skills add https://github.com/blinqas/station --skill terraform-test-blinqas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraform configurations evolve and can regress if tests are not run, which risks unstable deployments. This Skill provides a structured framework to define and execute Terraform tests against modules to detect regressions, validate behavior, and protect production environments.

Core Features & Use Cases

  • Unit tests run in plan mode with deterministic behavior and no real resources.
  • Integration tests run in apply mode (or with mocks) to validate end-to-end module behavior.
  • Supports mock providers, multiple test blocks, assertions, and module testing for local and registry modules.

Quick Start

Run your Terraform tests locally to validate module changes before merging.

Frequently Asked Questions about terraform-test

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

FAQPage Schema
How do I run unit tests for Terraform modules without creating real resources?

Terraform unit tests run in plan mode with mock providers to validate configurations deterministically without deploying real infrastructure. This approach uses the tftest framework to execute test files containing run blocks and assertions safely.

What is the difference between plan-mode and apply-mode Terraform tests?

Terraform tests in plan-mode validate module logic using mocks without touching real resources, while apply-mode integration tests execute end-to-end behavior by applying configurations. Both modes support assertions and run blocks to verify module changes before merging.

How do I validate Terraform registry modules locally?

Terraform registry module validation is automated by running module-specific tests using the tftest framework. Users specify test files in the tests directory containing variables, run blocks, and assertions to check both local and registry module behavior.

Do I need the tftest framework to run Terraform configuration tests?

Yes, the tftest framework is required alongside Terraform to execute unit and integration tests. Users define test files with run blocks and assertions in the tests directory, and optional mock providers can be configured for plan-mode validation.

Why should I run Terraform tests before merging infrastructure changes?

Running Terraform tests detects regressions and validates module behavior before changes reach production. This structured testing framework executes unit and integration tests against modules to prevent unstable deployments and protect production environments.

Can I use mock providers with Terraform integration tests?

Yes, Terraform integration tests can run in apply mode or utilize mock providers to validate end-to-end module behavior. This allows deterministic testing of infrastructure configurations while supporting multiple test blocks and assertions.