Workspaces as code (WAC) brings the infrastructure as code paradigm to Coder workspaces. WAC allows you to define and create new workspaces using workspace templates.
Workspace templates are declarative YAML files that describe
how to configure workspaces and their supporting infrastructure. Coder supports
files with either the .yaml
or .yml
extension.
Requirements
- You must configure a Git OAuth service of your choice
- The image you use in your template must have been imported into Coder
- A
.coder/<template-name>.yaml
file exists in your repository.
Creating a workspace template
You can find a fully populated workspace template and descriptions of each field in our syntax guide.
Creating a workspace using a template
To create a new workspace using a template, go to New Workspace > Create from Template.
When prompted, provide:
- Workspace Name: A name for your workspace
- Git Repository URL: The git repository that contains your
coder.yaml
configuration file. See Workspace templates for more information about these files - Branch: The branch in your git repo to track
- Path to template: The path to your workspace template. By default, this
will be
.coder/coder.yaml
, but if you choose a different path, provide it here
Adding an embeddable button
To make it easy for your developers to use your template, you can generate an embeddable Markdown button for use in your repo. See the admin guide for details.
See an opportunity to improve our docs? Make an edit.
On this page