hashicorp avatar

Provider Test Patterns

Test structure, check functions, and scenario patterns for Terraform provider acceptance tests built on terraform-plugin-testing and the Plugin Framework.

CCM score
77 of 100
skills.sh installs
3.5K
GitHub stars
941
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the test lifecycle (plan, apply, refresh, final plan, destroy), TestCase and TestStep fields, and the provider factory setup
  • Includes ConfigStateChecks with custom statecheck.StateCheck implementations, plan checks, CompareValue, and legacy TestCheckFunc helpers alongside ComposeAggregateTestCheckFunc
  • Provides scenario patterns for basic, update, import, and disappears tests, plus reference files for checks, sweepers, and ephemeral resources
  • Designed for writing, reviewing, or debugging Terraform provider acceptance tests that use the Plugin Framework and terraform-plugin-testing

Install

$ npx -y skills add hashicorp/agent-skills --skill provider-test-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Provider Acceptance Test Patterns

Patterns for writing acceptance tests using terraform-plugin-testing with the Plugin Framework.

Source: HashiCorp Testing Patterns

References (load when needed):

  • references/checks.md — statecheck, plancheck, knownvalue types, tfjsonpath, comparers
  • references/sweepers.md — sweeper setup, TestMain, dependencies
  • references/ephemeral.md — ephemeral resource testing, echoprovider, multi-step patterns

Test Lifecycle

The framework runs each TestStep through: plan → apply → refresh → final plan. If the final plan shows a diff, the test fails (unless ExpectNonEmptyPlan is set). After all steps, destroy runs followed by CheckDestroy. This means every test automatically verifies that configurations apply cleanly and produce no drift — no assertions needed for that.


Test Function Structure

Details

Repository
github.com/hashicorp/agent-skills
Categories
Testing & QA, Go, DevOps & Cloud
First seen
May 16, 2026

More from hashicorp/agent-skills

All 16

Similar to Provider Test Patterns

More Testing & QA