Add masked API key data source - #100
Open
IlyaasK wants to merge 1 commit into
Open
Conversation
IlyaasK
marked this pull request as ready for review
July 11, 2026 22:58
IlyaasK
force-pushed
the
hypeship/deployment-data-source
branch
from
July 13, 2026 13:36
8a725e7 to
1b58199
Compare
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 13, 2026 13:36
2c0f72f to
8aee855
Compare
IlyaasK
force-pushed
the
hypeship/deployment-data-source
branch
from
July 13, 2026 14:32
1b58199 to
ee22563
Compare
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 13, 2026 14:32
8aee855 to
5b55393
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.
Reviewed by Cursor Bugbot for commit 5b55393. Configure here.
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 13, 2026 15:39
5b55393 to
3f5505e
Compare
IlyaasK
force-pushed
the
hypeship/deployment-data-source
branch
from
July 13, 2026 15:39
ee22563 to
2061aa5
Compare
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 20, 2026 19:38
3f5505e to
d88ea70
Compare
IlyaasK
force-pushed
the
hypeship/deployment-data-source
branch
from
July 20, 2026 19:38
2061aa5 to
932e241
Compare
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 21, 2026 14:46
d88ea70 to
f5cd0ba
Compare
IlyaasK
force-pushed
the
hypeship/deployment-data-source
branch
from
July 21, 2026 14:46
932e241 to
e4e3439
Compare
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 21, 2026 18:10
f5cd0ba to
bdfc3de
Compare
IlyaasK
force-pushed
the
hypeship/deployment-data-source
branch
from
July 21, 2026 19:51
18bf76f to
e5257d1
Compare
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 21, 2026 19:51
bdfc3de to
099bdff
Compare
Expose organization-scoped API key metadata without admitting plaintext or API key lifecycle into Terraform. Use the tagged SDK's paginated search and enforce exact-name identity in the provider, with focused unit and opt-in acceptance coverage.
IlyaasK
force-pushed
the
hypeship/api-key-data-source
branch
from
July 21, 2026 20:15
099bdff to
f3c4de0
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
Add the read-only
kernel_api_keydata source for masked API-key metadata by canonical ID or byte-exact name. Register it with the provider, document it, add a lookup example, and include focused unit and opt-in acceptance coverage.Scope
This PR adds one data source only. It does not add an API-key resource, create/rotate actions, runtime operations, or direct HTTP fallback code.
API contract
The tagged Kernel Go SDK v0.76.0 exposes organization-scoped masked Get and paginated List methods. List query is substring matching, so the provider scans every non-deleted result page, deduplicates canonical IDs, applies byte-exact name equality, and reports zero or multiple matches instead of selecting by list order. Provider
project_idis deliberately not sent to these organization endpoints.Terraform state semantics
The data source accepts exactly one of
idorname. State contains canonical identity, masked key metadata, optional project metadata, timestamps, and creator metadata. Deleted keys and malformed API responses are rejected. Expired but non-deleted keys remain readable according to the API status contract. Data sources do not support import.Sensitive data
masked_keyis marked sensitive. Plaintext values returned by fixture creation are never used, logged, placed in Terraform configuration, or stored in state. No rotate method is exposed by the provider wrapper.Verification
gofmt -l cmd internalgo test -short -count=1 -timeout=2m ./...go vet ./...terraform fmt -check -recursive examplesbash scripts/check-docs.shbash scripts/check-examples.shbash scripts/check-markdown-links.shThe opt-in acceptance test creates a uniquely named project-scoped key with an organization-wide administrative credential, reads it by ID and exact name, verifies masked/no-drift state, deletes it, and verifies coded absence. It was not run locally because live credentials are unavailable; it remains a manual release gate.
Deferred concerns
The
kernel_api_keyresource remains blocked on replayable Create/Rotate idempotency and a reliable way to prevent managing or deleting the key currently authenticating Terraform. Those blockers remain documented indocs/api-key-state.md.This PR does not resolve a GitHub issue.
Note
Medium Risk
Introduces organization-scoped credential metadata reads and sensitive masked state, but read-only with no plaintext or rotation; main risk is lookup/pagination correctness and ambiguous name handling after rotation.
Overview
Adds the read-only
kernel_api_keydata source so Terraform can resolve masked API-key metadata by canonicalidor byte-exactname(exactly one selector). State exposes identity, project metadata, timestamps, creator fields, and sensitivemasked_keyonly—no plaintextkeyor rotation/resource fields.Name lookup uses the SDK’s substring list query with active status, walks all pages, deduplicates by ID, applies byte-exact name equality (workaround until an exact-name list filter ships), and errors on zero or ambiguous matches.
internal/kernelclientadds org-scoped Get/List (no providerproject_idheader on these endpoints) plus Create/Delete for acceptance fixtures; Rotate stays unexposed.The provider registers the data source; docs, changelog, migration notes,
examples/lookups, generated schema docs, and the manual acceptance workflow matrix are updated accordingly. Unit and opt-in acceptance tests cover pagination, ambiguity, malformed responses, and live ID/name reads with cleanup.Reviewed by Cursor Bugbot for commit f3c4de0. Bugbot is set up for automated code reviews on this repo. Configure here.