The provisioner executes Terraform to create and destroy workspaces. When a developer creates a workspace, the provisioner runs your template.
Provisioning flow
Standard Terraform workflow: init → plan → apply for creates, destroy for deletes
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
Template directory
What you can provision
Use any Terraform provider: VMs, containers, databases, GPUs, or even services like Tailscale and Cloudflare.
Kubernetes
PodsAWS
EC2 instancesGoogle Cloud
Compute EngineAzure
Azure VMsDocker
ContainersTerraform
ProvisionerDeployment options
Built-in
Provisioner runs inside the Coder server process. Simplest setup—no extra infrastructure.- No separate deployment
- Scales with control plane
- Good for most teams
External
Provisioner runs as a separate process. Better isolation and independent scaling.- Isolate Terraform workload
- Scale provisioners independently
- Advanced security boundaries
Use cloud-native identity to authenticate the provisioner. No static credentials needed.
Cloud-native identity, no static keys: Use your cloud provider's identity solution. No API keys to rotate or store.
AWS
Use IAM roles attached to the EC2 instance or EKS pod. No keys in config.Google Cloud
Use GKE workload identity or service account attached to GCE instance.Azure
Use Azure Managed Identity for AKS or VM. No secrets in Terraform.Kubernetes
Use Kubernetes service accounts with RBAC for pod creation.Store templates in git. Push updates via CI to create new template versions.
Pro tip: Run coder templates plan in CI to catch errors before pushing.
FAQs
Yes, but you don't need to be an expert. Templates are standard Terraform. If you can write a terraform resource block, you can write a Coder template. We provide starter templates for common scenarios.
Yes. Use any Terraform module from the registry or your own private modules. Templates are just Terraform with a few Coder-specific resources for workspace agents and metadata.
Depends on what you provision. Kubernetes pods start in seconds. VMs take 1-2 minutes. Large VMs with many attached resources may take 3-5 minutes. Terraform runs in parallel where possible.
The workspace stays in "failed" state. Developers can view Terraform logs to debug. Admins can fix the template and developers can retry. Failed workspaces don't consume resources.
Yes. Use Terraform variables with validation. Expose instance type, region, or storage size as parameters. Set defaults and constraints. Developers pick values when creating workspaces.