Define API key Terraform state design - #84
Open
IlyaasK wants to merge 1 commit into
Open
Conversation
IlyaasK
marked this pull request as ready for review
July 11, 2026 15:59
IlyaasK
force-pushed
the
hypeship/app-data-source
branch
from
July 13, 2026 13:35
e741e1a to
ae07bda
Compare
IlyaasK
force-pushed
the
hypeship/api-key-state-design
branch
3 times, most recently
from
July 13, 2026 15:39
d2751dc to
6bf88e0
Compare
IlyaasK
force-pushed
the
hypeship/app-data-source
branch
from
July 13, 2026 15:39
aae651a to
3a87f31
Compare
IlyaasK
force-pushed
the
hypeship/app-data-source
branch
from
July 20, 2026 19:38
3a87f31 to
2fdba56
Compare
IlyaasK
force-pushed
the
hypeship/api-key-state-design
branch
from
July 20, 2026 19:38
6bf88e0 to
12ca1a6
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 12ca1a6. Configure here.
IlyaasK
force-pushed
the
hypeship/api-key-state-design
branch
from
July 21, 2026 14:46
12ca1a6 to
f7b91b9
Compare
IlyaasK
force-pushed
the
hypeship/app-data-source
branch
from
July 21, 2026 18:10
2a84554 to
eac44ec
Compare
IlyaasK
force-pushed
the
hypeship/api-key-state-design
branch
from
July 21, 2026 18:10
f7b91b9 to
91aa9cf
Compare
IlyaasK
force-pushed
the
hypeship/app-data-source
branch
from
July 21, 2026 19:51
eac44ec to
eab41e8
Compare
IlyaasK
force-pushed
the
hypeship/api-key-state-design
branch
from
July 21, 2026 19:51
91aa9cf to
cc2e49b
Compare
IlyaasK
force-pushed
the
hypeship/api-key-state-design
branch
from
July 21, 2026 20:15
cc2e49b to
7c330ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Defines the Terraform state and lifecycle boundary for future Kernel API-key support.
kernel_api_keydata source from the blockedkernel_api_keyresource.Why this is v1 work
API keys are durable configuration, but their one-time plaintext and ability to authenticate the provider make them higher risk than ordinary metadata resources. v1 requires an accepted state and recovery model before lifecycle code is added.
Resource and data-source scope
This PR is documentation only. It does not register a resource or data source and makes no API, SDK, provider, or state changes.
The masked metadata data source may proceed after a tagged SDK exposes the API's exact-name list filter. The resource remains deferred.
API contract
The latest tagged Go SDK, v0.76.0, exposes API-key Create, Get, Update, List, Delete, and Rotate. Reads are masked; Create and Rotate return plaintext once. Rotate creates a new canonical ID, clamps old-key grace to its existing expiration, and retains the expired old row as non-deleted history. Names are non-unique, and the API's exact filter uses case- and accent-insensitive database collation.
The pending v0.77.0 SDK release generates the exact-name list field. This provider will continue to use the SDK only.
Terraform state semantics
The future resource model distinguishes readable durable metadata from provider-preserved intent:
keyis sensitive computed plaintext preserved after Create or Rotate and null after import.masked_key, creator, project metadata, and timestamps come from durable reads.rotation_keeperis the only rotation trigger.Sensitive field handling
Terraform sensitivity controls display, not backend encryption. The design requires an encrypted, access-controlled state backend because plaintext remains in state history. Masked reads never replace plaintext state, and import never claims to recover plaintext.
Import behavior
Future resource import accepts the canonical API-key ID and reads masked metadata only. Plaintext, the original relative lifetime, and prior rotation keeper remain unset. A keeper configured after import is an explicit first rotation.
Verification
Passed locally:
gofmt -l cmd internalgo test -short -timeout=2m ./...go vet ./...go mod verifygo mod tidy -diffterraform fmt -check -recursive examplesbash scripts/check-docs.shbash scripts/check-markdown-links.shgit diff --checkAcceptance status
No acceptance test applies to this documentation-only PR. The design records the required future matrix for Create, Read, rename, rotation, import, scope, historical rows, lifetime edges, deletion, and self-use safety.
Deferred concerns
The resource must not ship until all three gates are met:
The masked data source waits only for the tagged exact-name SDK surface.
GitHub issues
This PR does not resolve an existing GitHub issue.
Note
Low Risk
Documentation-only changes with no runtime, state, or authentication behavior.
Overview
This PR is documentation only—no provider, SDK, or API code.
It adds
docs/api-key-state.md, which accepts the futurekernel_api_keyTerraform state model (sensitive plaintext preservation,rotation_keeper-driven rotation, project-scope resolution, metadata-only import) and spells out lifecycle, validation, and safety rules aligned with the current Kernel API/SDK (v0.76.0, pending v0.77.0 exact-name list).It defers the resource until replayable Create/Rotate idempotency and a current-key self-rotation guard with effective project-scope metadata exist, while allowing the masked
kernel_api_keydata source after a tagged SDK exposes the exact-name filter.docs/architecture.mdnow points v1 readers at that design doc and restates the same unblock vs. proceed split for API-key work.Reviewed by Cursor Bugbot for commit 7c330ea. Bugbot is set up for automated code reviews on this repo. Configure here.