Live webinar: Building Autonomous Agent Workflows You Can Trust, Dec 15Register now

Secrets Management

Your secrets stay in your vault—Coder just injects them

How it works

Coder integrates with your existing secrets solution. At workspace startup, secrets are fetched and injected as environment variables or files. Coder never stores secrets.

Supported backends

Note: Any secrets manager with an API can integrate via Terraform.

HashiCorp Vault

Industry standard

AWS Secrets Manager

Cloud-native

GCP Secret Manager

Google Cloud

Azure Key Vault

Microsoft Azure

Kubernetes

K8s Secrets

Environment variables

Simple setup

Injection flow

What Coder does / doesn’t do

Coder does

  • Fetch secrets via Terraform at startup
  • Inject secrets as environment variables
  • Write secrets to files (if needed)
  • Support dynamic, per-workspace secrets
  • Rotate secrets when workspace restarts
  • Audit which secrets were accessed

Coder doesn’t

  • Store secrets in database
  • Cache secrets between restarts
  • Bake secrets into container images
  • Expose secrets in logs or UI
  • Share secrets between users
  • Require you to migrate secrets
Example: Vault integration

Terra Template code (HCL)

Secret scoping

Per-template

Shared secrets for all workspaces from a template. Example: dev database credentials.
path = "secret/template/dev"

Per-user

User-scoped secrets. Each developer gets their own path in Vault.
path = "secret/user/${user}"

Per-workspace

Dynamic secrets generated per workspace. Auto-revoked on deletion.
path = "aws/creds/${workspace}"
FAQs

FAQs

No. Secrets are fetched from your secrets manager (Vault, AWS, etc.) at workspace startup via Terraform. They pass through the provisioner but are never persisted in Coder's database or logs.

Yes. You can use Terraform variables like ${user} and ${workspace} to fetch user-specific or workspace-specific secrets. For example, path = "secret/user/${user}/github" in Vault.

If you're using dynamic secrets (like Vault database credentials or AWS IAM roles), they're automatically revoked when the workspace is deleted. Static secrets remain in your secrets manager.

Secrets are injected at workspace startup. To pick up rotated secrets, restart the workspace. For long-running workspaces, consider using short-lived dynamic credentials instead.

Move secrets from Dockerfiles and git repos to your secrets manager. Update your Coder template to fetch them via Terraform. Workspaces created from the new template will use the secrets manager.