provider-test-patterns
Acceptance test patterns for Terraform providers using terraform-plugin-testing
Developer Setup
Setup & Installation
npx skills add https://github.com/hashicorp/agent-skills --skill provider-test-patternsnpx skills add https://github.com/hashicorp/agent-skills --skill provider-test-patternsOverview
What This Skill Does
Patterns for writing Terraform provider acceptance tests using terraform-plugin-testing with the Plugin Framework. Covers TestCase and TestStep structure, ConfigStateChecks with custom StateCheck implementations, plan checks, import testing, sweepers, and ephemeral resource testing. Includes concrete scenarios for basic, update, disappears, validation, and regression tests.
Application
When to use this Skill
- Configuring integration settings for custom agent workflows.
- Optimizing query execution and response latency in production.
- Developing clean, standard-compliant implementations for enterprise services.
- Troubleshooting connection timeouts and authentication handshakes.
- Monitoring API rate limits and execution pipelines programmatically.
Documentation
Show Skills.md file
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, comparersreferences/sweepers.md— sweeper setup, TestMain, dependenciesreferences/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.
Recommendations