CtrlK
BlogDocsLog inGet started
Tessl Logo

terraform-test

Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating infrastructure behavior with assertions, mocking providers and data sources, testing module outputs and resource configurations, or troubleshooting Terraform test syntax and execution.

Install with Tessl CLI

npx tessl i github:hashicorp/agent-skills --skill terraform-test
What are skills?

84

1.78x

Quality

88%

Does it follow best practices?

Impact

84%

1.78x

Average score across 10 eval scenarios

SKILL.md
Review
Evals

Evaluation results

100%

40%

Write Terraform Tests for an S3 Bucket Module Without Cloud Credentials

Mock provider and assert block syntax

Criteria
Without context
With context

mock_provider block

100%

100%

mock_resource sub-block

0%

100%

mock_data sub-block

0%

100%

Assert condition field

100%

100%

Assert error_message field

100%

100%

60%

Write Terraform Tests for an EC2 Module

Expect failures and variable overrides

Criteria
Without context
With context

expect_failures attribute

100%

100%

Checkable object reference

100%

100%

File-level variables block

0%

0%

Run-level variable override

0%

0%

Plan mode for validation

100%

100%

100%

Write Terraform Tests for a Multi-Module Network Stack

Module block testing and run output references

Criteria
Without context
With context

Module block with source

100%

100%

Run output reference syntax

100%

100%

Sequential dependency order

100%

100%

Multiple run blocks

100%

100%

tftest.hcl extension

100%

100%

95%

95%

Write a Complete Test Suite for an IAM Role Module

Test file organization and plan vs apply modes

Criteria
Without context
With context

Tests directory

0%

66%

Unit test naming

0%

100%

Integration test naming

0%

100%

Plan mode explicit

0%

100%

Apply mode default

0%

100%

65%

50%

Write Terraform Tests for a Multi-Module Infrastructure Platform

State key management and parallel execution

Criteria
Without context
With context

state_key attribute used

0%

100%

parallel attribute set

0%

0%

Separate state for parallel

0%

50%

Synchronization point

33%

100%

No cross-parallel references

66%

100%

Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.