feat(keymanager): Barbican key-manager family (pcd_keymanager_secret, _container) — Phase 3 - #18
Merged
Merged
Conversation
…ner) Phase 3. New internal/services/keymanager package + a KeyManagerV1Client (catalog type "key-manager") on the shared config. Resources: pcd_keymanager_secret (all fields immutable; write-only sensitive payload; wait-for-ACTIVE only when a payload is supplied, since a payload-less secret stays PENDING) and pcd_keymanager_container (immutable grouping of secrets via secret_refs, computed consumers). Data source: pcd_keymanager_secret (lookup by name or ref; optionally fetches the payload when payload_content_type is set). Barbican identifies objects by a full URL ref (secret_ref/container_ref) but the API's Get/Delete take the bare UUID: refToID extracts it, the resource ID is the UUID, and the full ref is a computed attribute. Create returns only the ref, so the resources derive the UUID and Get for the rest. Write-only payload and the ForceNew inputs are echo-only (populated from the server only when unset), so configured values round-trip exactly and imports don't force a replace. Acceptance test (secret + container + data source + import), examples under the new "Key Manager" registry subcategory, CHANGELOG, and DECISIONS row included. build/vet/gofmt/golangci-lint (0 issues) and tfplugindocs all clean.
…fs schema Adversarial review caught two container bugs: - consumers was built as []map[string]string and passed to a List of ObjectType, which the framework cannot reflect (Value Conversion Error) once a container has any consumer (an empty list silently worked, hiding it). Build it from a struct slice like secret_refs. - secret_refs was Optional-only but readInto populates it from the server when unset, so a container created without secret_refs failed with 'inconsistent result after apply'. Make it Optional+Computed to permit the server value.
PF9-pushkar
added a commit
that referenced
this pull request
Jul 14, 2026
feat(keymanager): Barbican key-manager family (pcd_keymanager_secret, _container) — Phase 3
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.
Third Phase 3 family — Barbican key management. New
internal/services/keymanagerpackage + aKeyManagerV1Client(catalog typekey-manager).Resources & data source
pcd_keymanager_secret— write-only/sensitivepayload, immutable (all inputs ForceNew).pcd_keymanager_container— a named grouping of secrets (secret_refs) with computedconsumers.pcd_keymanager_secret(data source) — lookup by name or ref; optionally fetches the payload whenpayload_content_typeis set.Barbican's ref-vs-UUID quirk
Barbican addresses objects by full-URL refs (
secret_ref/container_ref), but Get/Delete take the bare UUID, and Create returns only the ref. Handled centrally:refToIDextracts the UUID (the resource ID), the full ref is a computed attribute, and the resource derives the UUID then Gets for the rest. Write-onlypayloadis echo-only +ImportStateVerifyIgnore'd; the wait-for-ACTIVEfires only when a payload is supplied (a payload-less secret stays PENDING forever).Adversarial review fixes included
The review caught two real container bugs:
consumersValue Conversion Error — built as[]map[string]stringbut the attribute is a List of objects; the framework can't reflect a map into an ObjectType, so a container with any consumer failed on Create/Read (an empty list silently worked, hiding it). Now built from a struct slice.secret_refsinconsistent result — it was Optional-only but populated from the server when omitted, so a container created withoutsecret_refsfailed with "inconsistent result after apply". Now Optional+Computed.Checks
go build/vet/gofmt/golangci-lint(0 issues),tfplugindocs generate("Key Manager" subcategory), andterraform fmton the new examples all clean. Acceptance test covers a secret + container + data source + import.Live-validation status
Code-complete + adversarially reviewed. Not run against the CE lab this session (credentials unavailable). Like DNS, Barbican is live (Step 0) and needs no compute/storage backend, so this family should pass live once creds return. Tracked in
DECISIONS.md.