hashicorp avatar

Provider Test Patterns

This gives Claude the patterns for writing Terraform provider acceptance tests with terraform-plugin-testing and the Plugin Framework. It covers the test lifecycle (plan, apply, refresh, final plan check), modern ConfigStateChecks with statecheck implementations versus legacy TestCheckFunc patterns, import testing with ImportStateKind, sweepers, and ephemeral resource testing. The source includes actual code examples for test structure, config helpers with numbered format verbs, and scenario patterns like basic/update combinations and disappears tests. Use it when you're writing or reviewing provider tests and need to know how to structure assertions, verify import behavior, or understand why CompareValue exists for cross-step checks. It assumes you know Terraform providers but need the testing framework conventions.

skills.sh installs
3.4K
GitHub stars
924
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/hashicorp/agent-skills
Categories
Testing & QA, DevOps & CI/CD, Documentation, AI & Agent Building, Debugging, Productivity & Planning, Cloud & Infrastructure
First seen
May 16, 2026

More from hashicorp/agent-skills

All 16
1phuryn avatartest-scenariosphuryn/pm-skillsCreate comprehensive test scenarios from user stories with test objectives, starting conditions, user roles, step-by-step actions, and expected outcomes. Use wh3Kskills.sh installs
2android avatartesting-setupandroid/skillsAnalyze and create a testing strategy for native Android apps - install testing libraries, set up test infrastructure, create harnesses for unit tests, UI tests3Kskills.sh installs
3openai avatartest-tuiopenai/codexGuide for testing Codex TUI interactively2.8Kskills.sh installs
4owl-listener avatarusability-test-planowl-listener/designer-skillsDesign a usability test plan with tasks, success metrics, participant criteria, and facilitation guide. Use when planning moderated or unmoderated usability tes2.4Kskills.sh installs
5nvidia avatarmcore-testingnvidia/skillsTest system for Megatron-LM. Covers test layout, recipe YAML structure, adding and running unit and functional tests, golden values, marker filters, and CI pari1.8Kskills.sh installs
6alirezarezvani avatarstress-testalirezarezvani/claude-skills/em:stress-test — Business assumption stress testing. Use before betting on a plan whose core assumptions are unvalidated — e.g. stress-testing 'enterprise buye1.5Kskills.sh installs