Skip to content

provider-resources: replace AWS-internal patterns with generic Plugin Framework guidance - #79

Open
AdamTylerLynch wants to merge 2 commits into
hashicorp:mainfrom
AdamTylerLynch:fix/provider-resources-generic-pf
Open

provider-resources: replace AWS-internal patterns with generic Plugin Framework guidance#79
AdamTylerLynch wants to merge 2 commits into
hashicorp:mainfrom
AdamTylerLynch:fix/provider-resources-generic-pf

Conversation

@AdamTylerLynch

@AdamTylerLynch AdamTylerLynch commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

The provider-resources skill was written against terraform-provider-aws internals
without saying so: r.Meta().ExampleClient(ctx), conns.Client, tftags.TagsSchema(),
verify.SetTagsDiff, tfresource.NotFound, acctest.ProtoV5ProviderFactories. None
of these exist outside that repository, so the skill actively misled anyone building
any other provider. It also conflicted with its sibling skills (legacy
ComposeTestCheckFunc vs provider-test-patterns' ConfigStateChecks; ProtoV5 vs
ProtoV6; legacy website/docs/ layout vs provider-docs' tfplugindocs layout).

Changes

  • States the policy up front: Plugin Framework for all net-new resources/data
    sources
    ; SDKv2 only for maintaining existing resources; migrate via
    terraform-plugin-mux (per the AWS provider's contributor guidance). Removed the
    SDKv2 example code accordingly
  • All examples now use a generic examplecloud client stored on the resource via a
    standard Configure() + interface assertions — the shape any provider can copy
  • Read removes missing resources from state (tflog.Warn + RemoveResource); Delete
    tolerates already-deleted; consistent error grammar ("creating Widget (%s): %s")
  • Added the Plugin Framework id guidance: omit a redundant id when the API has a
    natural identifier; ImportStatePassthroughID
  • Testing section aligned with provider-test-patterns: ProtoV6 factories, modern
    ConfigStateChecks, required coverage (_basic + import step, _disappears,
    per-attribute), config style rules (indexed %[1]q, self-contained configs,
    randomized names, no hard-coded values)
  • Documentation section now points at tfplugindocs/docs/, deferring to the
    provider-docs skill — resolving the three-way docs-layout conflict
  • Two new load-on-demand references distilled from the AWS provider contributor docs:
    • references/design-principles.md — resource = smallest building block, one
      resource ↔ one API, singular vs plural data source semantics,
      relationship/async-task/version modeling
    • references/retries-and-waiters.md — three eventual-consistency failure classes,
      status/wait function pairs, post-create not-found retries, typed-error-only retries

Verification: scripts/validate-structure.sh passes; SKILL.md shrinks 599 → 514
lines; zero references to AWS-internal packages remain.


Addresses the acceptance-test coverage, docs-generation, singular+plural data source, changelog, and Framework-first guidance requested in #14 (the follow-up commit adds the terraform-plugin-mux detection heuristic suggested there, the recommendation to ship both data source forms, and a changelog checklist item).

@AdamTylerLynch
AdamTylerLynch requested a review from a team as a code owner July 13, 2026 17:23
@AdamTylerLynch

Copy link
Copy Markdown
Contributor Author

Duplicate/overlap flag: #41 (@bbasata) also rewrites this same file, terraform/provider-development/skills/provider-resources/SKILL.md, and the two PRs take different approaches to the same problem — they will hard-conflict on merge:

Both are answers to the "should this be split into Framework/SDKv2 skills?" discussion in #14 (@ffalor / @bbasata). Flagging so maintainers can reconcile the two rather than merge one and silently clobber the other. My related #86 (provider-framework-migration) is where I moved the SDKv2 content, which keeps this skill Framework-only without needing the SDK-specific split.

@leefowlercu

Copy link
Copy Markdown
Collaborator

Thanks for the heads up @AdamTylerLynch. Will update this thread when resolution is decided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants