terraform-test

Execute unit tests against Terraform modules without provisioning real infrastructure.

1|Updated Nov 1, 2021
One-click install
npx skills add https://github.com/clowa/my-setup --skill terraform-test-clowa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-test
Source: https://github.com/clowa/my-setup/tree/main/opencode/skills/terraform-test
Command: npx skills add https://github.com/clowa/my-setup --skill terraform-test-clowa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraform projects often suffer from unvalidated changes that can break infrastructure or cause drift. This Skill provides structured unit testing workflows to validate modules, resources, and outputs without creating real resources.

Core Features & Use Cases

  • Unit tests for Terraform configurations using tftest and Terraform's validation capabilities.
  • Validate module inputs, outputs, resource counts, and provider configurations across environments.
  • Use Case: quickly verify changes to a module before applying to production.

Quick Start

Use the terraform-test skill to create a minimal tests/ directory with a simple run block and assertions, then run terraform test to execute the unit tests.

Frequently Asked Questions about terraform-test

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

FAQPage Schema
How do I unit test Terraform modules without provisioning real infrastructure?

You can unit test Terraform modules without provisioning real infrastructure by creating a tests/ directory with run blocks and assertions, then executing terraform test to validate resources and outputs in plan mode.

What is the best way to validate Terraform configuration changes before applying to production?

The best way to validate Terraform configuration changes before production is to run unit tests against module inputs, outputs, and resource counts using tftest and Terraform's validation capabilities to catch breaks early.

Can I use mock providers with Terraform tests during plan-mode testing?

Yes, you can use mock providers with Terraform tests during plan-mode testing to validate provider configurations across environments without actually creating real resources or modifying infrastructure.

How do I structure test files and run blocks for Terraform configurations?

To structure Terraform test files, create a minimal tests/ directory containing simple run blocks, variable definitions, providers, and assertion blocks to systematically verify module behavior.

Does terraform test work for validating provider configurations across environments?

Yes, terraform test works for validating provider configurations across environments by executing unit tests that apply mock providers during plan-mode testing to ensure infrastructure-as-code consistency.