terraform-test

Run deterministic Terraform test scenarios against plan outputs and temporary infrastructure.

Updated Oct 16, 2025
One-click install
npx skills add https://github.com/Axeloooo/TheDataBay --skill terraform-test-axeloooo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-test
Source: https://github.com/Axeloooo/TheDataBay/tree/main/.agents/skills/terraform-test
Command: npx skills add https://github.com/Axeloooo/TheDataBay --skill terraform-test-axeloooo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Terraform Test prevents breaking infrastructure changes by letting you verify configuration updates in a safe, repeatable way before applying them to real environments.

Core Features & Use Cases

  • Plan-mode validation (unit tests): Quickly check expressions, outputs, and resource configuration without touching real infrastructure.
  • Apply-mode integration checks: Validate real resource behavior by provisioning temporary infrastructure in isolated runs.
  • Deterministic mocking for fast CI: Use mock providers for Terraform 1.7.0+ to test logic without cloud credentials and avoid flaky external dependencies.
  • Scenario coverage with run blocks: Model multiple scenarios in a single test file using variables, provider overrides, plan options, assertions, and expected failures.
  • Separation for CI filtering: Structure tests into unit (plan) vs integration (apply) files so pipelines can run them independently.

Quick Start

Ask the AI to help you write a .tftest.hcl file that runs in plan mode and asserts critical resource properties for your module.

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 changes before deploying to real infrastructure?

Terraform test files validate changes by running deterministic test scenarios against plan outputs using assertions, preventing breaking infrastructure updates before applying them to real environments.

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

Terraform test modes differ by isolation: plan-mode validates expressions and resource configurations without touching infrastructure, while apply-mode provisions temporary real infrastructure for integration checks.

How do I run Terraform integration tests in CI without cloud credentials?

You can run Terraform tests in CI without cloud credentials by using mock providers to test logic and avoid flaky external dependencies, requiring Terraform 1.7.0 or later for mock support.

How do I structure Terraform test files for independent CI pipeline filtering?

Structure Terraform tests into separate unit files using plan-mode and integration files using apply-mode so CI pipelines can independently filter and run them based on the desired validation scope.

Can I model multiple test scenarios in a single Terraform test file?

You can model multiple scenarios in a single Terraform test file by defining run blocks with variables, provider overrides, plan options, assertions, and expected failures for comprehensive coverage.

How does state isolation work when running multiple Terraform test run blocks?

State isolation in Terraform tests is managed via the state_key option within run blocks, ensuring deterministic provisioning when multiple scenarios execute against temporary infrastructure.