hashicorp/agent-skills/provider-resources
Claude Code and agent skill by hashicorp/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Implement Terraform Provider resources and data sources using the Plugin Framework: CRUD operations, schema design, plan modifiers and validators, not-found handling, waiters for eventually consistent APIs, import support, resource design principles, and required acceptance test coverage. Use when adding or changing a resource or data source, deciding whether an API concept should be a resource, wiring a resource to the provider's configured client, handling drift or resource-not-found, or reviewing a resource implementation before submission.
Install
npx vskill@latest install hashicorp/agent-skills/provider-resourcesSKILL.md
The same SKILL.md was published earlier as hashicorp/agent-skills/provider-resources.
Terraform Provider Resources Implementation Guide
Overview
This guide covers developing Terraform Provider resources and data sources. Resources represent infrastructure objects that Terraform manages through Create, Read, Update, and Delete (CRUD) operations.
Use the [Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework) for all net-new resources and data sources. Plugin SDKv2 is for maintaining resources that already exist on it; do not write new code against it. A provider can serve both during migration by muxing (terraform-plugin-mux), so adopting the Framework never requires a big-bang rewrite. To tell which mode an existing provider is in, check go.mod: terraform-plugin-mux present means it serves both SDKv2 and Framework code; only terraform-plugin-sdk/v2 means SDKv2-only; only terraform-plugin-framework means Framework-only. Be cautious about migrating existing SDKv2 resources: the Framework distinguishes null from zero values, so naive migrations change behavior for existing users (use the provider-framework-migration skill, if available).
References (load when needed):
references/design-principles.md— what should (and should not) become a
resource; data source semantics; relationship and async-task modeling
references/retries-and-waiters.md— eventual consistency, retry
patterns, and status/wait function structure
File Structure
Most providers keep every resource in a single package:
Large multi-service providers (e.g. terraform-provider-aws) split into internal/service/<service>/ packages instead, with an idiomatic file taxonomy worth adopting once a package grows: consts.go, find.go (finders), status.go (status functions), wait.go (waiters), sweep.go (test sweepers), exports_test.go.
Documentation lives in docs/ and is generated with tfplugindocs:
(Hand-written website/docs/r/*.html.markdown trees exist in some older, large providers — follow the target repo's convention when editing one.)
Resource Structure
A Framework resource is a struct holding the API client, with interface assertions making the implemented behaviors explicit:
How the provider's Configure produces that client — schema, credential resolution, validation — is covered by the provider-configuration skill (if available).
On `id`: SDKv2 required a magic id attribute; the Framework does not. If the API has its own identifier, expose it under its real meaning and do not add a second, redundant id. Only keep id when it is the API's identifier (as above).
CRUD Operations
Create
Read
Read must handle out-of-band deletion by removing the resource from state so the next plan recreates it, rather than erroring forever:
Update
Only call the API for attributes that actually changed; compare plan against state:
Delete
Treat "already gone" as success — the desired end state is reached:
Import
With ResourceWithImportState asserted, passthrough of the identifier is one line:
For multi-part identifiers, parse a delimited import ID (commonly comma-separated) and set each attribute explicitly.
Resource Design Principles
Before implementing, check the shape of the thing being modeled (full treatment in references/design-principles.md):
- A resource is the smallest useful building block; if the API offers
CRUD for it, it likely deserves its own resource.
- A resource should talk to one API/service only — cross-service
resources break permissions, auditing, and endpoint configuration.
- Data sources are read-only and side-effect free. A singular data source
errors on zero or multiple matches; a plural data source (plural noun name) returns zero-or-more as a collection and errors on neither.
- Attached policies/rules, long-running task invocations, and versioned
artifacts usually deserve their own resources rather than attributes on the parent.
- Start/stop or enable/disable state belongs as an attribute in the
resource, not as a separate resource.
Schema Design
Attribute Types
| Terraform Type | Framework Type | Use Case | |
|---|---|---|---|
string | schema.StringAttribute | Names, identifiers | |
number | schema.Int64Attribute, schema.Float64Attribute | Counts, sizes | |
bool | schema.BoolAttribute | Feature flags | |
list | schema.ListAttribute | Ordered collections | |
set | schema.SetAttribute | Unordered unique items | |
map | schema.MapAttribute | Key-value pairs | |
object | schema.SingleNestedAttribute | Complex nested config |
Give every attribute a MarkdownDescription — tfplugindocs publishes it, and it is the primary user-facing documentation.
Plan Modifiers
Validators
Sensitive Attributes
State Management
Finders
Centralize "get one thing or a typed not-found" in a finder so Read, Delete, waiters, and tests all share identical not-found semantics:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/terraform/skills/provider-resources/SKILL.md
Popularity
- Repository stars
- 873
- Repository forks
- 130
- 7-day trend score
- 34
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hashicorp/agent-skills/provider-resources)