terraform-test

Write and run Terraform test files with assertions and mock providers.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/qprjack86/apexbase --skill terraform-test-qprjack86
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-test
Source: https://github.com/qprjack86/apexbase/tree/main/.github/skills/terraform-test
Command: npx skills add https://github.com/qprjack86/apexbase --skill terraform-test-qprjack86

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you create reliable Terraform tests that validate infrastructure logic before deployment, reducing manual verification and avoiding costly mistakes.

Core Features & Use Cases

  • Unit-style Terraform testing: Write plan-mode .tftest.hcl scenarios to verify naming, tags, outputs, and conditional resources.
  • Integration-style Terraform testing: Use apply-mode runs to provision real Azure infrastructure and confirm end-to-end behavior.
  • Mock provider support: Simulate Azure provider responses for fast CI checks and local development without real credentials.
  • Troubleshooting and diagnostics: Use verbose output, cache bypass, cleanup control, and sequential run dependencies to debug failing tests.
  • Use case: Validate an Azure resource group module, confirm mandatory tags, reject invalid input, and optionally run a full-stack deployment test.

Quick Start

Ask the AI to write a Terraform test file for your module that validates the expected Azure resources, tags, and input rules in plan mode.

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 to validate Azure module naming and tags?

You write a .tftest.hcl file containing run blocks and assertions to validate Azure module naming and tags. Terraform test files use plan-mode execution to check expected resources and input rules before deployment.

Can I use mock providers for Terraform tests without real Azure credentials?

Yes, you can use mock providers in your Terraform test blocks to simulate Azure provider responses. Mock providers allow fast CI checks and local development without requiring real Azure credentials or deploying infrastructure.

What is the difference between plan-mode and apply-mode in .tftest.hcl files?

Plan-mode in .tftest.hcl files checks resource attributes, naming, and tags without deploying. Apply-mode provisions real Azure infrastructure to verify end-to-end behavior and integration before cleaning up.

How do I test validation rules and conditional resources in Terraform modules?

You test validation rules and conditional resources in Terraform modules by writing assertions inside run blocks. These assertions verify that invalid inputs are rejected and conditional resources are created as expected.

How do I troubleshoot failing Terraform tests with sequential run dependencies?

Troubleshoot failing Terraform tests by using verbose output, cache bypass, and cleanup control. Configure sequential run dependencies in your .tftest.hcl to ensure blocks execute in order and diagnose failures accurately.