Skip to content

Wire extension deletion into Terraform - #68

Open
IlyaasK wants to merge 1 commit into
hypeship/extension-delete-corefrom
hypeship/extension-delete-framework
Open

Wire extension deletion into Terraform#68
IlyaasK wants to merge 1 commit into
hypeship/extension-delete-corefrom
hypeship/extension-delete-framework

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • decode kernel_extension state in the Terraform Framework Delete boundary
  • delegate deletion to the reviewed durable Delete core
  • stop before the API call when Terraform state cannot decode
  • propagate dependency and API diagnostics so Terraform retains ownership
  • rely on Terraform's normal diagnostic-free Delete behavior to remove state
  • cover identity/scope delegation, dependency propagation, and malformed-state no-call behavior

Resource scope

This PR covers only the Terraform Framework adapter for kernel_extension Delete. The resource remains unregistered until Create, Read, Delete, and Import are assembled as a complete lifecycle.

API contract notes

The underlying core issues one project-scoped SDK DELETE with mutation retries disabled. It treats coded extension not_found as converged success and coded HTTP 400 resource_in_use as a durable browser-pool dependency. This adapter does not duplicate that policy.

Terraform state semantics

A diagnostic-free Delete lets Terraform remove state automatically. Any malformed state, dependency conflict, project failure, transport failure, or generic API error returns diagnostics, so Terraform keeps the canonical ID and retries later.

Sensitive fields

This slice introduces no sensitive fields and never reads, stores, or logs archive bytes, API keys, credentials, or runtime data.

Import behavior

Import is intentionally unchanged in this PR and will land as a separate reviewed slice before resource registration.

Verification

  • gofmt -l cmd internal
  • go test -count=20 ./internal/resources/extension
  • go test -race -count=1 ./internal/resources/extension
  • go test -count=1 -short -timeout=2m ./...
  • go vet ./...
  • go mod verify
  • go mod tidy -diff
  • terraform fmt -check -recursive examples
  • bash scripts/check-docs.sh
  • bash scripts/check-examples.sh
  • bash scripts/check-markdown-links.sh
  • git diff --check

All commands passed locally. Tests are fake-client based, deterministic, network-free, and container-free.

Acceptance status

No registered complete resource exists yet, so live acceptance testing is not applicable to this adapter-only slice. Extension acceptance remains a required pre-release gate after registration.

Deferred concerns

  • no force delete or implicit browser-pool/runtime cleanup
  • extension upload still lacks API idempotency keys
  • Import and full resource registration remain separate stack layers

GitHub issues

This PR does not resolve #24 or #25. Force-delete remains intentionally excluded, and provider code remains handwritten under the documented codegen decision.


Note

Low Risk
Adapter-only slice with no resource registration; behavior is delegated to reviewed delete core and covered by fake-client unit tests.

Overview
Adds the Terraform Plugin Framework Delete boundary for kernel_extension: decode state from DeleteRequest, then call the existing deleteExtension core (no duplicated API policy).

deleteExtensionResource returns early on state decode errors so the API is never invoked with bad state; successful deletes rely on Terraform’s normal diagnostic-free Delete to drop state, while dependency/API errors surface as diagnostics so state is retained.

New unit tests cover project/id delegation to DeleteExtension, propagation of resource_in_use dependency messaging, and ensuring malformed state never triggers a delete call.

Reviewed by Cursor Bugbot for commit 6b1210f. Bugbot is set up for automated code reviews on this repo. Configure here.

@IlyaasK
IlyaasK requested review from Sayan- and tnsardesai and removed request for Sayan- and tnsardesai July 11, 2026 07:18
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-core branch from e8f49fd to 33d82ee Compare July 13, 2026 13:34
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-framework branch from 1441404 to e8c3978 Compare July 13, 2026 13:34
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-core branch from 33d82ee to d60c9e5 Compare July 13, 2026 14:32
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-framework branch from e8c3978 to c65cc5f Compare July 13, 2026 14:32
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-core branch from d60c9e5 to 1ed2fbb Compare July 13, 2026 15:39
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-framework branch from c65cc5f to 14b2fa6 Compare July 13, 2026 15:39
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-core branch from 1ed2fbb to a5debe6 Compare July 20, 2026 19:38
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-framework branch 3 times, most recently from 3cd8e7e to e4d77bc Compare July 21, 2026 18:10
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-core branch from 25f8375 to c7cd2bc Compare July 21, 2026 18:10
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-framework branch from e4d77bc to d168bc8 Compare July 21, 2026 19:51
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-core branch from 1f105b7 to cb4e287 Compare July 21, 2026 20:15
@IlyaasK
IlyaasK force-pushed the hypeship/extension-delete-framework branch from d168bc8 to 6b1210f Compare July 21, 2026 20:15
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.

1 participant