Skip to main content

Manage Secrets

Declare a secret in a manifest, add its value in Google Cloud Secret Manager and inject it into an application. Never put a secret value in Git.

Prerequisites​

  • An Application manifest that needs the secret.
  • The names of your organization, organizational-unit, environment and project.

Steps​

  1. Create the Secret manifest. It declares an empty secret. It has no value.

    apiVersion: lowops.manifests.v1
    kind: Secret
    metadata:
    name: partner-api-key
    project: payment-gateway
    environment: production
    organizational-unit: retail-banking
    organization: fincorp
    spec:
    description: "API key for the external partner integration"
  2. Open a pull request and merge it. The platform creates the empty secret in Secret Manager.

  3. Open Secret Manager in the Google Cloud console for the project. Select the secret and choose Add new version. Enter the value.

  4. Grant the application access in its accessControl block. The key is the name of the Secret manifest.

    spec:
    accessControl:
    secrets:
    partner-api-key:
    envVar: PARTNER_API_KEY # expose as this environment variable
    # version: "latest" # optional: pin a version
  5. Open a pull request and merge it.

Verify​

The platform grants the service account of the application read access to the secret. It restarts the application with the value in PARTNER_API_KEY.

Next​