Skip to content

Add kernel_deployment data source - #99

Open
IlyaasK wants to merge 78 commits into
hypeship/v1-release-publishfrom
hypeship/deployment-data-source
Open

Add kernel_deployment data source#99
IlyaasK wants to merge 78 commits into
hypeship/v1-release-publishfrom
hypeship/deployment-data-source

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • register a read-only kernel_deployment data source backed by the tagged Go SDK's direct deployment GET
  • expose canonical ID, project scope, entrypoint, region, computed status metadata, timestamps, and environment variable names
  • add focused unit coverage, an opt-in live test using the existing release-owned app fixture, generated docs, and a lookup example

Resource/data-source scope

Adds kernel_deployment data source only. The deployment resource remains deferred. This PR does not create, stop, delete, invoke, follow, or stream anything.

API contract notes

Kernel Go SDK v0.76.0 already exposes project-scoped Deployments.Get. The provider-local wrapper adds only GetDeployment; it does not expose deployment create, delete, or event-stream methods. Source provenance, app name, version, and actions remain omitted because the tagged GET model does not return them; kernel_app remains the app metadata lookup.

Terraform state semantics

id is the required canonical selector. project_id follows the existing explicit override, provider default, then API-key binding order. Computed status and status reason are inspection metadata only. Missing or null optional metadata normalizes to null, and present malformed API fields produce diagnostics.

Sensitive field handling

The API returns redacted deployment environment values. Terraform state stores only sorted env_var_keys; the schema has no environment-value field. Logs, events, source credentials, and GitHub tokens are not read or stored.

Import behavior

Not applicable to a data source. The blocked deployment resource still requires its separately documented import and deletion contracts.

Tests run

  • gofmt -l cmd internal
  • go test -short -timeout=2m ./...
  • go vet ./...
  • terraform fmt -check -recursive examples
  • bash scripts/check-docs.sh
  • bash scripts/check-markdown-links.sh
  • bash scripts/check-examples.sh
  • Actionlint across all workflows

Acceptance status

An opt-in acceptance test reads the deployment backing KERNEL_ACC_APP_NAME and KERNEL_ACC_APP_VERSION through explicit and provider-default project scope, then verifies a clean plan. It performs no deployment lifecycle or runtime operation. It was compiled but not run locally because live Kernel credentials are unavailable; the manual acceptance workflow includes the package.

Known deferred concerns

The kernel_deployment resource remains blocked on tagged source provenance, authoritative deletion/read-after-delete semantics, complete durable app/version readback, and accepted write-only environment/token state behavior. SDK source provenance remains deferred until a tagged release contains it.

Issues

Does not resolve a GitHub issue.


Note

Low Risk
Read-only data source with no lifecycle mutations; sensitive values are excluded from state by design.

Overview
Adds a read-only kernel_deployment data source so Terraform can inspect durable deployment metadata via a direct SDK GET, without create/delete, logs, or event streams.

Read path maps region, status (inspection-only), entrypoint, timestamps, and sorted env_var_keys only—never env values, source, or app metadata. project_id follows the same explicit → provider default → API-key binding resolution as other lookups. kernelclient gains GetDeployment only; lifecycle/event SDK methods stay unexposed.

Provider registration, generated docs, the lookups example (deployment ID from kernel_app), acceptance matrix + workflow job, and unit/acceptance tests complete the surface. The kernel_deployment resource remains deferred.

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

IlyaasK and others added 6 commits July 10, 2026 09:35
Set the durable v1 target and release gates before resource implementation begins.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use the latest tagged SDK while keeping provider behavior unchanged.
Expose org-scoped project mutations without automatic retries so Terraform resource work can use the generated SDK safely.
Define the durable project schema and pure SDK conversion boundary before wiring resource lifecycle behavior.
Model definite, successful, and uncertain project creation without exposing a partial Terraform resource. Preserve recoverable identity on ambiguous outcomes and direct operators to import before retrying.
@IlyaasK
IlyaasK marked this pull request as ready for review July 11, 2026 22:15
@IlyaasK
IlyaasK requested review from Sayan- and tnsardesai July 11, 2026 22:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7a7591c. Configure here.

Comment thread internal/datasources/deployment/datasource.go
@IlyaasK
IlyaasK force-pushed the hypeship/deployment-data-source branch from 7a7591c to 8a725e7 Compare July 11, 2026 22:28
@IlyaasK
IlyaasK removed request for Sayan- and tnsardesai July 13, 2026 13:25
IlyaasK added 8 commits July 13, 2026 09:29
Join all project flatten diagnostics in uncertain create outcomes so operators see every invalid durable field. Add a regression test covering simultaneous missing ID and name values.
Read projects by canonical state ID, remove state only for coded not-found responses, and reject malformed or identity-changing API responses. Cover the pure unregistered lifecycle core with focused tests.
Build SDK error and response fixtures before parallel Create subtests so helper failures use the owning parent test before child execution begins.
Build a name-only SDK patch for changed project plans, skip unchanged names, and reject unknown values before the network boundary.
Apply name-only patches by canonical state ID, skip no-op updates, and validate complete SDK responses before returning new Terraform state.
Implement non-force project deletion with explicit state-preserving diagnostics, idempotent coded-not-found handling, and focused status-boundary tests. Document the API's indistinguishable projects-disabled not-found response as a residual provider risk.
Seed imported project state with the exact non-empty canonical ID and an unknown name so the normal Read lifecycle settles durable state.
Translate Terraform create plans into the reviewed project creation core and persist recoverable identity before uncertain diagnostics. Keep registration deferred until the complete lifecycle is wired.
@IlyaasK
IlyaasK force-pushed the hypeship/v1-release-publish branch from a53f1fb to 0ba61eb Compare July 13, 2026 13:36
@IlyaasK
IlyaasK force-pushed the hypeship/deployment-data-source branch 2 times, most recently from 1b58199 to ee22563 Compare July 13, 2026 14:32
IlyaasK added 4 commits July 13, 2026 11:24
Separate recovery guidance for creates with and without recoverable state, and normalize empty SDK errors so Terraform always reports an actionable reason.
Refresh validated durable state, remove only confirmed missing projects, and preserve pre-populated Terraform state on diagnostics or malformed input.
Translate Framework update requests into the tested project update core while preserving prior state on diagnostics and no-op plans.
Decode prior project state, delegate to the non-force delete core, and preserve Terraform ownership by returning diagnostics on malformed state or API failure.
@IlyaasK
IlyaasK force-pushed the hypeship/v1-release-publish branch from 3755aea to f96c137 Compare July 13, 2026 15:39
@IlyaasK
IlyaasK force-pushed the hypeship/deployment-data-source branch from ee22563 to 2061aa5 Compare July 13, 2026 15:39
IlyaasK added 18 commits July 21, 2026 16:13
Add a validated GoReleaser contract so provider archives, checksums, and the registry manifest are reproducible before signed tag publishing is enabled.
Build and verify unsigned registry assets in a read-only tag workflow so release owners can inspect a deterministic handoff before signing or publication is enabled.
Require protected release approval before importing the Registry key, signing the prepared checksum, and publishing retry-safe GitHub Release assets.
Expose direct project-scoped deployment metadata without logs, event streams, source fields absent from the tagged SDK, or environment values.
@IlyaasK
IlyaasK force-pushed the hypeship/v1-release-publish branch from fc3f751 to af23b48 Compare July 21, 2026 20:15
@IlyaasK
IlyaasK force-pushed the hypeship/deployment-data-source branch from e5257d1 to 190705e Compare July 21, 2026 20:15
@IlyaasK
IlyaasK force-pushed the hypeship/v1-release-publish branch 10 times, most recently from 29407cd to 371cda6 Compare July 30, 2026 19:31
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