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.

91

1.49x
Quality

86%

Does it follow best practices?

Impact

100%

1.49x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

SKILL.md
Quality
Evals
Security

Evaluation results

100%

44%

Add a Terraform Test Suite for an S3 Bucket Module

Test file naming and structure

Criteria
Without context
With context

tests/ directory

100%

100%

Unit test filename suffix

0%

100%

Integration test filename suffix

0%

100%

Unit tests use plan

0%

100%

Integration tests use apply

0%

100%

Descriptive run block names

100%

100%

Informative error messages

100%

100%

expect_failures for validation

100%

100%

Variable combinations covered

100%

100%

Assert conditions use can/regex

0%

100%

No git/HTTP module sources

100%

100%

Separate files created

100%

100%

100%

34%

Write a Mock-Based Unit Test Suite for a VPC Terraform Module

Mock providers and sequential tests

Criteria
Without context
With context

mock_provider block used

100%

100%

mock_resource defaults

0%

100%

mock_data defaults

0%

100%

Mocks paired with plan mode

100%

100%

Sequential run reference

0%

100%

alltrue for expression

100%

100%

Conditional resource count test

100%

100%

expect_failures in mock test

100%

100%

Descriptive run block names

100%

100%

Specific error messages

87%

100%

Unit test filename

0%

100%

No apply with mocks

100%

100%

100%

19%

Set Up Automated Testing Pipeline for a Terraform Module

CI/CD pipeline configuration

Criteria
Without context
With context

Unit tests on PR trigger

100%

100%

Integration tests on main only

100%

100%

Unit test filter flag

66%

100%

Integration test filter flag

66%

100%

Credentials as secrets

100%

100%

No credentials in unit job

100%

100%

terraform fmt check step

0%

100%

terraform validate step

100%

100%

terraform init step

50%

100%

Verbose test output

87%

100%

Integration depends on unit

100%

100%

Valid CI config format

100%

100%

Repository
hashicorp/agent-skills
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.