terraform-test

Write and execute Terraform tests with run blocks and assertions.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/MrAlexisCord/chatbot-prototype --skill terraform-test-mralexiscord
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-test
Source: https://github.com/MrAlexisCord/chatbot-prototype/tree/main/.agents/skills/terraform-test
Command: npx skills add https://github.com/MrAlexisCord/chatbot-prototype --skill terraform-test-mralexiscord

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to writing and executing Terraform tests, ensuring your infrastructure configurations are robust, reliable, and free from breaking changes.

Core Features & Use Cases

  • Write and Run Terraform Tests: Learn to create .tftest.hcl files, define run blocks for apply or plan modes, and use assert blocks for validation.
  • Mock Providers & Advanced Scenarios: Understand how to simulate provider behavior with mocks, test modules, manage state, and execute tests in parallel.
  • Use Case: When developing a new Terraform module, use this Skill to write unit tests that validate default configurations and integration tests that deploy and verify actual infrastructure before merging changes.

Quick Start

Use the terraform-test skill to learn how to write a basic Terraform test file.

Frequently Asked Questions about terraform-test

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

FAQPage Schema
How do I write a Terraform test file using the built-in testing framework?

To write a Terraform test, you create a `.tftest.hcl` file containing `run` blocks for `apply` or `plan` modes, and use `assert` blocks to validate your infrastructure configurations and outputs.

Can I use mock providers in Terraform tests to simulate infrastructure behavior?

Yes, you can use mock providers in Terraform tests to simulate provider behavior, allowing you to test modules, manage state, and execute tests in parallel without deploying actual infrastructure.

What is the best way to validate Terraform module configurations before merging changes?

The best way to validate module configurations is by writing unit tests for default configurations and integration tests that deploy and verify actual infrastructure, ensuring configurations are free from breaking changes.

How do assertions and run blocks work when testing infrastructure as code?

Assertions validate resource configurations and outputs within `run` blocks, which define whether the test executes a `plan` or an `apply` operation against your infrastructure code.

Does the Terraform testing framework support parallel execution and state management?

Yes, the Terraform testing framework supports parallel execution and state management, providing patterns for unit and integration testing including resource validation, output checking, and conditional logic.