Register the durable extension resource - #70
Conversation
d7fb05b to
5b45b85
Compare
e8209f1 to
77e6c31
Compare
| func extensionReplacementPlanned(state, plan extensionModel) bool { | ||
| return extensionStringChanged(state.Name, plan.Name) || | ||
| extensionStringChanged(state.ProjectID, plan.ProjectID) || | ||
| extensionStringChanged(state.SourceSHA256, plan.SourceSHA256) |
There was a problem hiding this comment.
Forced replace skips archive checks
Medium Severity
extensionReplacementPlanned only looks for diffs on name, project_id, and source_sha256, so a forced replace with unchanged attributes never sets requiresArchive. Plan can succeed without source_path / source_sha256 in config, then destroy runs and create fails afterward, which can delete the remote extension before upload is possible.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 77e6c31. Configure here.
5b45b85 to
d3ca1f6
Compare
77e6c31 to
89a023f
Compare
d3ca1f6 to
eac46f5
Compare
89a023f to
1a00529
Compare
ba94d10 to
af6f0c1
Compare
663532d to
af1b09e
Compare
af6f0c1 to
a741065
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a741065. Configure here.
Assemble the reviewed extension lifecycle helpers behind a Terraform Plugin Framework resource, require local archive inputs only for create or replacement, and publish generated schema documentation. This makes the durable extension surface usable while keeping runtime operations out of Terraform.
af1b09e to
345affd
Compare
a741065 to
073a4b8
Compare


Summary
kernel_extensionTerraform resourcesource_pathandsource_sha256only when Terraform creates or replaces an extensionWhy this v1 work
This activates the already-reviewed durable extension implementation as one complete Terraform resource. Kernel extensions are immutable through the current API, so name, project scope, and archive checksum changes replace the resource instead of using an update call.
Resource scope
The resource manages uploaded extension configuration only. It does not expose browser sessions, extension runtime state, downloads, logs, screenshots, live view, acquire/release, or implicit browser-pool mutation.
API contract notes
Terraform state semantics
source_pathis write-only and never persisted in plan or state artifacts<extension-id>or<project-id>/<extension-id>, seeds canonical identity and scope, then Read settles remote metadataSensitive fields
No secret is added. The local archive path is write-only; provider
api_keysensitivity is unchanged.Tests run
gofmt -l cmd internalgo test -short -timeout=2m ./...go test -race ./internal/resources/extension ./internal/providergo vet ./...terraform fmt -check -recursive examplesbash scripts/check-docs.shbash scripts/check-examples.shbash scripts/check-markdown-links.shgit diff --check HEAD^ HEADAcceptance status
Real-API Terraform acceptance has not run in this PR. Create, replacement, import, and delete remain an opt-in acceptance/release gate; focused unit, race, schema, docs, and local-provider example validation pass.
Deferred concerns
GitHub issue disposition
No existing issue is closed by this registration slice. Runtime operations and broader mutable extension API behavior remain outside this PR.
Note
Medium Risk
New resource lifecycle affects real Kernel extension uploads and deletes; immutability/replace behavior must be correct to avoid unintended replacements or failed deletes when pools reference extensions.
Overview
Registers
kernel_extensionon the Kernel Terraform provider so uploaded extensions can be managed as durable infrastructure (create, read, delete, import) via the existing client helpers.The Plugin Framework resource treats extensions as immutable:
Updateis rejected, and changes toname,project_id, orsource_sha256are expected to replace the resource.ModifyPlanenforcessource_path(write-only) andsource_sha256whenever Terraform creates or replaces an extension, but not on no-op plans or destroy.Provider wiring adds the resource factory (and renames the extension data source import for clarity). Tests cover schema, configure, update rejection, and plan-time archive validation; generated
docs/resources/extension.mddocuments the schema.Reviewed by Cursor Bugbot for commit 073a4b8. Bugbot is set up for automated code reviews on this repo. Configure here.