Terraform Workspace Template
This Terraform module provisions a Coder workspace that mirrors the devcontainer experience defined in this repository. The files in tf/ are mounted into the workspace at /home/coder/code-tools, so the helper scripts referenced below are always available.
What You Get
- One Docker workspace container built from
var.devcontainer_image(defaults togit.lab/vasceannie/golden-image:latest). - Optional PostgreSQL, Redis, and Qdrant services running on the same Docker network, plus pgAdmin and Jupyter toggles.
- Startup scripts that install core tooling and (optionally) AI helpers for Claude, Cursor, and Windsurf.
- A trimmed Coder application list (VS Code, Terminal, pgAdmin, Qdrant, Jupyter, and a few common dev ports).
Key Inputs
| Name | Description | Default |
|---|---|---|
devcontainer_image |
Workspace container image | git.lab/vasceannie/golden-image:latest |
workspace_memory_limit |
Memory limit in MB (0 = image default) | 8192 |
enable_docker_in_docker |
Mount /var/run/docker.sock |
true |
postgres_password / redis_password |
Service credentials | devpassword |
postgres_max_connections |
PostgreSQL connection cap | 100 |
redis_max_memory |
Redis maxmemory setting | 512mb |
pgadmin_email / pgadmin_password |
pgAdmin login | admin@dev.local / adminpassword |
install_* flags |
Control which AI helpers run when enabled | all true |
Workspace creators see only a handful of parameters:
- Optional repository URL to clone into
/workspaces. - Toggles for data services, AI tooling, pgAdmin, Jupyter, and JetBrains Gateway.
Files
main.tf # Providers, parameters, locals, Docker primitives
workspace.tf # Coder agent and workspace container
services.tf # PostgreSQL / Redis / Qdrant (+ pgAdmin & Jupyter)
apps.tf # Essential Coder apps and dev-port helpers
scripts.tf # Core + AI scripts wired to the agent
variables.tf # Minimal variable surface area
terraform.tfvars# Opinionated defaults you can override
outputs.tf # Helpful connection strings and metadata
scripts/ # Shell scripts invoked by Terraform resources
Usage
- From the Coder deployment (mounted at
/home/coder/code-tools/tf), runterraform initandterraform apply. - When prompted for the Project repository, supply any Git URL to clone into
/workspacesor leave it blank for an empty workspace. - Toggle services and AI tools to suit the workspace. If services are enabled, the bundled
port-forward.shscript exposes pgAdmin onlocalhost:5050and Qdrant onlocalhost:6333. - The devcontainer image should install language toolchains; the
workspace-setup.shanddev-tools.shscripts simply finish configuration inside the workspace.
Refer to Coder’s devcontainer template guide for broader context on how this Terraform fits into your deployment.