Grant agents approle write on ghp config KV path (to seed) #128
Reference in New Issue
Block a user
Delete Branch "benvin/grant-agents-ghp-config-write"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The
terraform-vaultmaster apply aborts because the KV pathkv/data/service/vault/au/syd1/secret_backend/ghp/config(keyadmin_token, aghpsvc_service token) is unseeded. The ghp secrets engine reads that value atghp/configcreation time, so the ghp data-source read fails and the apply stops. Granting theagentsAppRole scoped write to just this one KV path lets an agent seed the value so the apply can proceed.Changes
policies/kv/service/vault/au/syd1/secret_backend/ghp/config_write.yaml, avault_policybound to theagentsAppRole role only.create,update,readon the kv-v2 data pathkv/data/service/vault/au/syd1/secret_backend/ghp/config.readon the kv-v2 metadata pathkv/metadata/service/vault/au/syd1/secret_backend/ghp/config(read on plan/apply).secret_backendconfigs (least privilege).Caveat
This grant is itself a
vault_policyapplied by the master apply, which currently aborts on the ghp data-source read. So the policy likely needs to be applied first (a targeted apply of just thisvault_policy) before the agent can seed the KV path. The agent also still needs the actualghpsvc_service token value provided out-of-band to write intoadmin_token.