Fix Plugin Framework convention gaps (P0/P1) #31

Closed
opened 2026-06-14 18:17:23 +00:00 by ldraney · 2 comments
Owner

Type

Feature

Summary

Fix gaps identified by auditing godaddy-tofu against HashiCorp's scaffolding provider, terraform-plugin-framework source, and OpenTofu internals. These must be resolved before writing acceptance tests (#13).

User Story

As a provider developer, I want our provider to follow Plugin Framework conventions so that acceptance tests, debugging, and registry publishing work correctly.

Context

Audit compared our implementation against:

  • terraform-provider-scaffolding-framework (HashiCorp's official example)
  • terraform-plugin-framework v1.19.0 source
  • opentofu runtime internals

Nine gaps found. P0/P1 items block acceptance tests and correct runtime behavior.

Lineage

Parent: none
Story: dns-iac
Blocks: #13 (acceptance tests)

Repo

godaddy-tofu

Scope

P0 fixes:

  1. Add id attribute to godaddy_dns_record resource — Computed, UseStateForUnknown() plan modifier, set to domain:type:name in Create. Many tools expect resources to have id in state.
  2. Refactor New() to return factory — Change signature to New(version string) func() provider.Provider matching scaffolding. Update main.go accordingly.
  3. Add -debug flag to main.goflag.BoolVar(&debug, "debug", false, ...) with Debug: debug in ServeOpts. Required for delve debugging.
  4. Add retry/backoff to HTTP client — Wrap http.Client with hashicorp/go-retryablehttp for automatic retry on 429/500/502/503. Tests have retryOn429 but the client itself doesn't.

P1 fixes:
5. Add missing compile-time interface checkvar _ datasource.DataSourceWithConfigure = (*dnsRecordsDataSource)(nil) in data_source_dns_records.go.
6. Add terraform-plugin-testing to go.modgo get github.com/hashicorp/terraform-plugin-testing@latest. Required for #13.

File Targets

  • resource_dns_record.go (add id attribute)
  • main.go (debug flag, New() refactor)
  • provider.go (update New() call)
  • pkg/godaddy/client.go (retry middleware)
  • data_source_dns_records.go (interface check)
  • go.mod / go.sum (new dependencies)

Feature Flag

None

Test Expectations

  • go build ./... passes
  • go vet ./... passes
  • Existing pkg/godaddy/ tests still pass
  • main.go accepts -debug flag without error

Acceptance Criteria

  • DNS record resource has computed id attribute
  • New(version) returns func() provider.Provider
  • -debug flag wired up in main.go
  • HTTP client retries on 429/5xx with exponential backoff
  • dnsRecordsDataSource has compile-time interface check
  • terraform-plugin-testing in go.mod

Constraints

  • Do not change resource behavior — these are convention fixes, not feature changes
  • Retry middleware must not change test behavior (tests manage their own retry)

Checklist

  • id attribute added with UseStateForUnknown
  • New() factory pattern
  • Debug flag
  • go-retryablehttp integrated
  • Interface check added
  • terraform-plugin-testing dependency added
  • go build/vet clean

Blocks: #13 (acceptance tests)
Informed by: audit of terraform-plugin-framework, scaffolding provider, OpenTofu source

### Type Feature ### Summary Fix gaps identified by auditing godaddy-tofu against HashiCorp's scaffolding provider, terraform-plugin-framework source, and OpenTofu internals. These must be resolved before writing acceptance tests (#13). ### User Story As a provider developer, I want our provider to follow Plugin Framework conventions so that acceptance tests, debugging, and registry publishing work correctly. ### Context Audit compared our implementation against: - `terraform-provider-scaffolding-framework` (HashiCorp's official example) - `terraform-plugin-framework` v1.19.0 source - `opentofu` runtime internals Nine gaps found. P0/P1 items block acceptance tests and correct runtime behavior. ### Lineage Parent: none Story: dns-iac Blocks: #13 (acceptance tests) ### Repo godaddy-tofu ### Scope **P0 fixes:** 1. **Add `id` attribute to `godaddy_dns_record` resource** — Computed, `UseStateForUnknown()` plan modifier, set to `domain:type:name` in Create. Many tools expect resources to have `id` in state. 2. **Refactor `New()` to return factory** — Change signature to `New(version string) func() provider.Provider` matching scaffolding. Update `main.go` accordingly. 3. **Add `-debug` flag to `main.go`** — `flag.BoolVar(&debug, "debug", false, ...)` with `Debug: debug` in `ServeOpts`. Required for delve debugging. 4. **Add retry/backoff to HTTP client** — Wrap `http.Client` with `hashicorp/go-retryablehttp` for automatic retry on 429/500/502/503. Tests have `retryOn429` but the client itself doesn't. **P1 fixes:** 5. **Add missing compile-time interface check** — `var _ datasource.DataSourceWithConfigure = (*dnsRecordsDataSource)(nil)` in `data_source_dns_records.go`. 6. **Add `terraform-plugin-testing` to go.mod** — `go get github.com/hashicorp/terraform-plugin-testing@latest`. Required for #13. ### File Targets - `resource_dns_record.go` (add id attribute) - `main.go` (debug flag, New() refactor) - `provider.go` (update New() call) - `pkg/godaddy/client.go` (retry middleware) - `data_source_dns_records.go` (interface check) - `go.mod` / `go.sum` (new dependencies) ### Feature Flag None ### Test Expectations - `go build ./...` passes - `go vet ./...` passes - Existing `pkg/godaddy/` tests still pass - `main.go` accepts `-debug` flag without error ### Acceptance Criteria - [ ] DNS record resource has computed `id` attribute - [ ] `New(version)` returns `func() provider.Provider` - [ ] `-debug` flag wired up in main.go - [ ] HTTP client retries on 429/5xx with exponential backoff - [ ] `dnsRecordsDataSource` has compile-time interface check - [ ] `terraform-plugin-testing` in go.mod ### Constraints - Do not change resource behavior — these are convention fixes, not feature changes - Retry middleware must not change test behavior (tests manage their own retry) ### Checklist - [ ] id attribute added with UseStateForUnknown - [ ] New() factory pattern - [ ] Debug flag - [ ] go-retryablehttp integrated - [ ] Interface check added - [ ] terraform-plugin-testing dependency added - [ ] go build/vet clean ### Related Blocks: #13 (acceptance tests) Informed by: audit of terraform-plugin-framework, scaffolding provider, OpenTofu source
Author
Owner

Scope Review: NEEDS_REFINEMENT

Review note: review-1464-2026-06-14
Issue is well-scoped with all template sections present, all 6 file targets verified against the codebase, and all acceptance criteria are agent-verifiable. Single traceability gap found:

  • [SCOPE] The arch:godaddy-tofu label is present on the board item but no backing architecture note (arch-godaddy-tofu) exists in pal-e-docs. Create the architecture note to close the traceability triangle.
## Scope Review: NEEDS_REFINEMENT Review note: `review-1464-2026-06-14` Issue is well-scoped with all template sections present, all 6 file targets verified against the codebase, and all acceptance criteria are agent-verifiable. Single traceability gap found: - `[SCOPE]` The `arch:godaddy-tofu` label is present on the board item but no backing architecture note (`arch-godaddy-tofu`) exists in pal-e-docs. Create the architecture note to close the traceability triangle.
Author
Owner

Scope Review: READY

Review note: review-1464-2026-06-14b
All template sections present, traceability complete, file targets verified against code. Previous review (review-1464-2026-06-14) incorrectly flagged arch-godaddy-tofu as missing -- the note exists (ID 1971, type: architecture, tags: architecture,active). No scope issues found. Ready for implementation.

## Scope Review: READY Review note: `review-1464-2026-06-14b` All template sections present, traceability complete, file targets verified against code. Previous review (`review-1464-2026-06-14`) incorrectly flagged `arch-godaddy-tofu` as missing -- the note exists (ID 1971, type: architecture, tags: architecture,active). No scope issues found. Ready for implementation.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/godaddy-tofu#31
No description provided.