Skip to content

Custom Key Vaults

Shared services can provision extra Key Vaults alongside the organization saifcorp vault. Declare them in infra/shared-services/keyvaults.yml. A missing or empty file creates none.

Declaring a Vault

keyvaults:
  - name: claims                 # becomes saifcorp-claims
    admin_groups:                # Key Vault Administrator
      - "<group-display-name>"
    reader_groups:               # Key Vault Reader
      - "<group-display-name>"
    secrets_user_groups:         # Key Vault Secrets User (read secrets)
      - "<group-display-name>"
Field Required Description
name yes Suffix only; saifcorp- is always prepended. Max 15 chars, lowercase alphanumerics and single hyphens, must not start or end with a hyphen or repeat the saifcorp- prefix, and must be unique in the list.
admin_groups no Entra ID group display names granted Key Vault Administrator.
reader_groups no Entra ID group display names granted Key Vault Reader.
secrets_user_groups no Entra ID group display names granted Key Vault Secrets User (read secrets).

Rules

  • Each vault gets three Entra security groups created by Terraform, named Azure-KeyVault-<Name>-<Role> (Name is the vault name with each hyphen-separated part capitalized, for example shared-docs becomes Shared-Docs): Admin (Key Vault Administrator), Reader (Key Vault Reader), and SecretsUser (Key Vault Secrets User). Add members to these groups; the *_groups fields above grant the same roles to additional, existing groups.
  • The full vault name must be globally unique. Soft-deleted vaults keep their name reserved.
  • Groups are resolved by display name at plan time; an unknown group fails the plan.
  • Vaults use Azure RBAC authorization. Only the three roles above are supported.
  • The per-environment Terraform Cloud service principals (terraformcloud-azure-<environment>-corporate) are always granted Key Vault Administrator on every custom vault, matching their access to the organization saifcorp vault.

Granting an App Access

Forge apps get read access to a custom vault by joining its SecretsUser group. Apps never get write or admin access this way.

  1. Declare the vault in keyvaults.yml and deploy it, so the Azure-KeyVault-<Name>-SecretsUser group exists. The group name omits the saifcorp- prefix: the vault saifcorp-claims has the group Azure-KeyVault-Claims-SecretsUser.
  2. List the vault in the app's key_vault_access input by its full name, including the saifcorp- prefix (keyvaults.yml still takes the suffix only):

    key_vault_access:
      - saifcorp-claims
    
  3. Deploy the app. Its workspace adds the app registration to the group. Existing members are not touched, and RBAC and group changes can take several minutes to propagate.

System Connector APIs (created from the saif-api-connector template, which sets app_proxy) skip this step for the saifcorp-connector vault: it is added to their key_vault_access automatically, so they are placed in Azure-KeyVault-Connector-SecretsUser without listing it.

Requesting Access for People and Groups

Terraform creates the role groups but does not manage their membership. Membership for people and other groups is requested separately:

  1. Submit a ServiceNow request to add the people, or an existing group, to the role group (Azure-KeyVault-<Name>-Admin, -Reader or -SecretsUser). Request the lowest role that covers the need.
  2. Ask in the same request for the group that holds the people to be made PIM-eligible for the role group, so access is activated just in time instead of being permanent.
  3. Members activate their PIM assignment before reading or writing secrets, and access ends when the activation expires.

App registrations are added by Forge as described above and do not need a request.

Where It Lives

  • keyvault-custom.tf parses the YAML, resolves groups, and enforces the naming preconditions.
  • permissions.tf grants the Terraform Cloud service principals Administrator on each vault.