Configuration and secrets
Keep settings in code and secrets in a store. Keep secrets out of state, let CI and services sign in with short-lived identity, and rotate on a timer.
- Required 1
- Recommended 4
Settings are values that may be public, such as a region or a pool size. Secrets are values that grant access, such as a database password. Code and state may hold settings, but never secrets. The app side is covered in Keep settings outside the code and Keep secrets in a secrets store. Secrets in container images are covered in Pass build secrets as mounts.
Required
Keep secrets out of state
INF-24Pass secrets to resources in a way that never writes them into the state or plan files.
Recommended
Create the secret's place in code and its value in the store
INF-23Create each secret's entry, owner and access policy in code. Put its value in the store by rotation or by hand, never through a code variable.
Let CI sign in with OIDC
INF-25Let pipelines sign in to the cloud with a short-lived token from the CI provider's OIDC issuer. Store no cloud key in CI secrets.
Give services the identity of their machine
INF-26Let each running service get cloud credentials from the platform's identity, such as an instance role, a Kubernetes service account or a managed identity. Put no cloud key in its settings.
Rotate secrets automatically
INF-27Let the secrets store rotate each secret on a schedule. The app picks up the new value without a deploy.
Read this with
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/configuration-and-secrets">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.