terraform-provider-design

Implements TDD workflows, drift detection tests, and plan checks for Terraform provider development.

1|1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/anyscale/terraform-provider-anyscale --skill terraform-provider-design-anyscale
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: terraform-provider-design
Source: https://github.com/anyscale/terraform-provider-anyscale/tree/main/.claude/skills/terraform-provider-design
Command: npx skills add https://github.com/anyscale/terraform-provider-anyscale --skill terraform-provider-design-anyscale

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Building a production-grade Terraform provider requires rigorous acceptance testing, drift detection, and API client design that go beyond basic CRUD scaffolding. This Skill fills the gaps left by the official HashiCorp skills by providing advanced patterns for Test-Driven Development, state and plan checks, and API client architecture. ## Core Features & Use Cases - TDD Workflow (RED-GREEN-REFACTOR): Write failing acceptance tests first, implement minimal CRUD, then refactor, with parallel execution across multiple resources. - Drift Detection Testing: Simulate external API modifications and verify the provider's Read operation detects changes using the three-step create-drift-restore pattern with plancheck.ExpectNonEmptyPlan. - Advanced State and Plan Checks: Use statecheck.ExpectKnownValue, CompareValue, tfjsonpath, knownvalue, ExpectSensitiveValue, and plancheck.ExpectEmptyPlan for idempotency verification. - API Client Architecture: Implement authentication (cookie/token), retry logic with exponential backoff, error handling, and snake_case to camelCase field mapping. - Use Case: When adding a new resource to a Terraform provider, use this Skill to generate a complete acceptance test suite covering create, import, update, idempotency, drift detection, and CheckDestroy cleanup verification. ## Quick Start Ask the AI to write a drift detection acceptance test for a Terraform resource using the three-step pattern with plan checks.

Frequently Asked Questions about terraform-provider-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write drift detection tests for a Terraform provider?▼

Use the three-step pattern: create the resource, modify it externally via the API in a PreConfig function, then verify Terraform detects the change with plancheck.ExpectNonEmptyPlan. Add a third step confirming Terraform restores the desired state, and wait about 2 seconds after external modification for eventual consistency.

How to verify Terraform provider idempotency with plan checks?▼

Add a second test step with the same configuration and use plancheck.ExpectEmptyPlan() in ConfigPlanChecks PreApply. This asserts that reapplying an unchanged configuration produces no operations, confirming the resource is idempotent.

What is the difference between state checks and plan checks in terraform-plugin-testing?▼

State checks (statecheck.ExpectKnownValue, CompareValue) validate attribute values in Terraform state after apply, while plan checks (plancheck.ExpectEmptyPlan, ExpectResourceAction) inspect the plan file before or after apply. Use state checks for computed attributes and plan checks for idempotency and drift verification.

Why does my drift detection test fail to detect external changes?▼

Common causes include using Terraform snake_case field names instead of the API's camelCase names, missing the eventual consistency wait after the API update, or sending an incomplete entity structure. Document field mappings in test helpers and sleep about 2 seconds after modifications.

When should I use this skill instead of the official HashiCorp provider skills?▼

Use the official new-terraform-provider skill for scaffolding and provider-resources for basic CRUD and schema. Use this skill for TDD workflows, drift detection, advanced state/plan checks, API client architecture, and HashiCorp's five design principles.