terraform-test-coverage

Assess Terraform native .tftest.hcl coverage across scenarios and naming conventions.

3|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/infraspecdev/tesseract --skill terraform-test-coverage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-test-coverage
Source: https://github.com/infraspecdev/tesseract/tree/main/shield/skills/terraform/test-coverage
Command: npx skills add https://github.com/infraspecdev/tesseract --skill terraform-test-coverage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps Terraform authors determine whether native test suites adequately cover a component before changes ship, reducing blind spots in critical infrastructure behavior.

Core Features & Use Cases

  • Evaluates coverage across happy paths, variable validations, feature toggles, edge cases, CIDR math, and naming conventions.
  • Checks for strong plan-only assertions, mock_provider usage, and required expect_failures coverage for validation rules.
  • Use it when adding new variables, resources, or flags, or when reviewing .tftest.hcl files before a release.

Quick Start

Review the component's .tftest.hcl files and produce a Terraform test coverage assessment with missing gaps and recommended additional tests.

Frequently Asked Questions about terraform-test-coverage

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

FAQPage Schema
How do I find missing test cases in my Terraform .tftest.hcl files?

You can find Terraform test coverage gaps by evaluating .tftest.hcl files against expected scenarios like happy paths, variable validations, feature toggles, edge cases, and CIDR math to produce a list of missing tests and recommended additions.

What does the native Terraform test coverage assessment check for?

The native Terraform test coverage assessment checks for strong plan-only assertions, proper mock_provider or override_resource usage, and explicit expect_failures coverage for validation blocks across your .tftest.hcl files.

How do I test Terraform variable validations and expect_failures correctly?

Testing Terraform variable validations requires explicit expect_failures blocks within your .tftest.hcl files. The coverage assessment verifies that these expect_failures statements are present and properly mapped to your validation rules.

Can I use mock_provider and override_resource patterns for Terraform test coverage?

Yes, the Terraform test coverage assessment specifically checks for mock_provider and override_resource patterns in your .tftest.hcl files to ensure resources are properly mocked and plan-only assertions are used without requiring real infrastructure provisioning.

When should I review Terraform test coverage before a release?

You should review Terraform test coverage before a release, or when adding new variables, resources, or feature flags, to ensure your .tftest.hcl files adequately cover critical infrastructure behavior and reduce blind spots before changes ship.

Does the Terraform coverage assessment check edge cases like CIDR math and naming conventions?

Yes, the Terraform coverage assessment explicitly evaluates whether your .tftest.hcl files include tests for edge cases, CIDR math, feature toggles, and naming conventions alongside standard happy paths and variable validations.