---
title: "Secrets Management | Coder"
description: "Your secrets stay in your vault—Coder just injects them"
image: "https://coder.com/og/explore/how-coder-works/secrets-management"
canonical: "https://coder.com/explore/how-coder-works/secrets-management"
---

[You manage](https://coder.com/explore/how-coder-works)

# 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

### Does Coder store secrets?

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.

### Can secrets be scoped per user or workspace?

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.

### What happens when a workspace is deleted?

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.

### Can I rotate secrets without restarting workspaces?

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.

### How do I migrate from baked-in secrets?

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.

## Ready to learn more?

[Try Open Source](https://coder.com/docs/install)

[Book a demo](https://coder.com/demo) [Contact sales](https://coder.com/contact/sales)
