GenAI & Agents · Agent-assisted

Vault Access via Directory Groups, Requested by an Agent, Approved by a Human

Vault identity, groups and policies are Terraform-managed, and an agent turns an access ticket into a validated branch and pull request that edits group membership.

  • HashiCorp Vault
  • Terraform
  • Python
  • GitHub Actions
  • GitHub Copilot

// Overview

In the Vault stack, policy files per environment are loaded, users are created with an OIDC accessor and identity groups attach policies. A platform workflow plans on pull requests and applies on merge. The agent (a Python CLI plus Copilot instructions) maps a role and environment to groups, validates the request, edits the membership config and opens a PR.

// The problem

Vault access requests were slow, error-prone manual edits.

// Flow

Vault Access via Directory Groups, Requested by an Agent, Approved by a Human flow1. Ticket → 2. Validate → 3. Existence check → 4. Branch → 5. Edit → 6. Pull request → 7. Review and plan → 8. Merge and apply → 9. Revoke01Ticket02 · GATEValidate03Existence check04Branch05Edit06Pull request07Review and plan08Merge and apply09Revoke
  1. Ticketrequest names role, environment and user
  2. Validate gateemail domain, role from a fixed list, environment upper, lower or both
  3. Existence checkuser looked up before the edit
  4. Branchcreated from latest main with a ticket-based name
  5. Edituser added to role groups for the chosen environments
  6. Pull requestcommit and PR opened; the agent applies nothing
  7. Review and planPR triggers plan-only workflow for both environments
  8. Merge and applyno-op plans skip apply
  9. Revokethe same path removes membership

// Design decisions & guardrails

  • The agent never applies; a human reviews the plan.
  • Role-to-group mapping is a fixed list, so the agent cannot invent roles.
  • Policies live as files in version control; PR-plan and merge-apply are split.
  • Chat and scan toggles are controlled per workflow.

// Outcome

Access changes become reviewed, revocable pull requests; 6 roles across 2 environments.

// Related