mock-testing

Execute and debug Terraform mock tests for Azure CAF modules.

7|5|Updated Jan 22, 2025
One-click install
npx skills add https://github.com/aztfmodnew/terraform-azurerm-caf --skill mock-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mock-testing
Source: https://github.com/aztfmodnew/terraform-azurerm-caf/tree/main/.github/skills/mock-testing
Command: npx skills add https://github.com/aztfmodnew/terraform-azurerm-caf --skill mock-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill ensures your Terraform modules are syntactically correct and generate valid plans without deploying actual resources, preventing costly errors and regressions.

Core Features & Use Cases

  • Syntax Validation: Verifies Terraform code correctness and variable references.
  • Plan Generation Check: Confirms that a Terraform plan can be successfully generated.
  • Regression Prevention: Catches breaking changes before they impact deployments.
  • Use Case: Before merging a change to an Azure networking module, run mock tests to ensure all resource configurations are valid and no syntax errors were introduced.

Quick Start

Execute mock tests for the chaos_studio module using its configuration file.

Frequently Asked Questions about mock-testing

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

FAQPage Schema
How do I validate Terraform module syntax without deploying to Azure?

You can validate Terraform module syntax without deploying to Azure by running mock tests that execute plan generation checks within the examples directory. This verifies code correctness and variable references without touching live infrastructure.

What is the best way to prevent Terraform module regressions before merging changes?

The best way to prevent Terraform module regressions is running mock tests that validate module syntax and plan generation. This catches breaking changes before they impact deployments, ensuring all resource configurations remain valid.

Do I need the Terraform CLI installed to run Azure CAF module mock tests?

Yes, you need the Terraform CLI installed to run Azure CAF module mock tests. The testing framework integrates with provider mock capabilities and requires a correctly structured test environment within the examples directory to execute successfully.

Can I use Terraform testing framework provider mocks to check plan generation for Azure modules?

Yes, you can use Terraform testing framework provider mocks to check plan generation for Azure modules. The mock testing executes and debugs plan generation to confirm that valid Terraform plans are successfully produced.

Why does my Terraform mock test fail when validating Azure CAF module configurations?

Terraform mock tests fail when module syntax is incorrect or the test environment is not correctly structured within the examples directory. Debugging these mock tests identifies invalid variable references and plan generation errors.

How does mocking Azure resources in Terraform testing prevent deployment errors?

Mocking Azure resources in Terraform testing prevents deployment errors by validating module syntax and confirming successful plan generation without live resource deployment. This ensures code quality and prevents costly errors before infrastructure changes are applied.