Skip to main content
skill CX Codex

terraform-test — Claude Code skill: Terraform tests

Guides an agent through Terraform test files, scenarios, assertions, and plan or apply runs. Use it when checking modules, resources, and outputs.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add hashicorp/agent-skills --skill terraform-test -a claude-code
Open on GitHub

What terraform-test does

This skill guides the creation of .tftest.hcl and .tftest.json files with run blocks, variables, and assert checks. It covers output checks, conditional resources, resource counts, tags, and data sources.

Use plan for logic checks, while apply creates temporary real resources. That makes provider settings worth checking before an apply run, even though existing infrastructure and state files are protected.

It also covers expected failures with expect_failures, sequential scenarios, and plan options. Provider and data-source mocks require Terraform 1.7.0+; module sources are limited to local paths or the registry.

What it helps with

  • create a .tftest.hcl test file
  • check module outputs
  • write a plan scenario without creating resources
  • test an expected validation failure
  • mock a provider for a test

Example prompts for the agent

  • Create tests/defaults_unit_test.tftest.hcl that checks the vpc_id output.
  • Write a plan test for a resource controlled by a variable.
  • Add expect_failures for an invalid environment value.

How to install terraform-test

1Skills CLI (Vercel)

npx skills add hashicorp/agent-skills --skill terraform-test -a claude-code

2Manually: put the files in place

~/.claude/skills/terraform-test/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/terraform-test/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about terraform-test

How do I install terraform-test in Claude Code?

Run npx skills add hashicorp/agent-skills --skill terraform-test -a claude-code, then run npx skills add hashicorp/agent-skills --skill terraform-test -a claude-code again. The skill file is placed at ~/.claude/skills/terraform-test/SKILL.md.

What does terraform-test do?

It helps an agent write and run Terraform tests with run scenarios and assert conditions. The guidance covers both plan and apply modes.

What Terraform version is needed for mocks?

Mock providers and data sources require Terraform 1.7.0+. They should be skipped on earlier versions.

Similar skills

All skills for Testing and QA →

From the same set20

terraform-style-guide A skill that generates and validates Terraform code according to HashiCorp's official standards. Ensures consistent, secure, and readable HCL across your configurations. CX Codex +1 12,600installs refactor-module This skill turns a monolithic Terraform configuration into reusable modules with clear variables and outputs. Useful when one main.tf has grown too risky to touch. CX Codex +1 6,400installs terraform-stacks Guides AI coding assistants through HashiCorp Terraform Stacks syntax, component definitions, and multi-environment deployment configs. CX Codex +1 5,600installs terraform-search-import Discovers untracked cloud assets and sets up Terraform configuration for bulk state imports. Helpful during infrastructure migrations and audits. CX Codex +1 4,900installs provider-resources This skill guides Terraform resource and data source work with the Plugin Framework. Use it when adding resources, handling drift, or reviewing provider code. CX Codex +1 4,100installs provider-actions Guides implementation of Terraform Actions with the Plugin Framework for operations run around resource create, update, and destroy events. CX Codex +1 3,900installs new-terraform-provider A skill that walks the agent through bootstrapping a Terraform provider on the Plugin Framework, from directory layout to a passing build. CX Codex +1 3,900installs run-acceptance-tests Runs and investigates Terraform provider acceptance tests with the TestAcc prefix. Use it for missing environment variables, failed runs, or tests that pass when they should not. CX Codex +1 3,700installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor