Files
coder/docs/admin/templates/creating-templates.md
Edward Angert 072c81cd73 docs: remove nested alerts (#18580)
hotfix

removes nested gfm alerts, which is a known ~issue~ feature
https://github.com/orgs/community/discussions/16925#discussioncomment-12043928

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2025-06-25 15:17:49 +00:00

4.7 KiB

Creating Templates

Users with the Template Administrator role or above can create templates within Coder.

From a starter template

In most cases, it is best to start with a starter template.

Web UI

After navigating to the Templates page in the Coder dashboard, choose Create Template > Choose a starter template.

Create a template

From there, select a starter template for desired underlying infrastructure for workspaces.

Starter templates

Give your template a name, description, and icon and press Create template.

Name and icon

If template creation fails, it's likely that Coder is not authorized to deploy infrastructure in the given location. Learn how to configure provisioner authentication.

CLI

You can the Coder CLI to manage templates for Coder. After logging in to your deployment, create a folder to store your templates:

# This snippet applies to macOS and Linux only
mkdir $HOME/coder-templates
cd $HOME/coder-templates

Use the templates init command to pull a starter template:

coder templates init

After pulling the template to your local machine (e.g. aws-linux), you can rename it:

# This snippet applies to macOS and Linux only
mv aws-linux universal-template
cd universal-template

Next, push it to Coder with the templates push command:

coder templates push

If template push fails, it's likely that Coder is not authorized to deploy infrastructure in the given location. Learn how to configure provisioner authentication.

You can edit the metadata of the template such as the display name with the templates edit command:

coder templates edit universal-template \
  --display-name "Universal Template" \
  --description "Virtual machine configured with Java, Python, Typescript, IntelliJ IDEA, and Ruby. Use this for starter projects. " \
  --icon "/emojis/2b50.png"

CI/CD

Follow the change management guide to manage templates via GitOps.

From an existing template

You can duplicate an existing template in your Coder deployment. This will copy the template code and metadata, allowing you to make changes without affecting the original template.

Web UI

After navigating to the page for a template, use the dropdown menu on the right to Duplicate.

Duplicate menu

Give the new template a name, icon, and description.

Duplicate page

Press Create template. After the build, you will be taken to the new template page.

New template

CLI

First, ensure you are logged in to the control plane as a user with permissions to read and write permissions.

coder login

You can list the available templates with the following CLI invocation.

coder templates list

After identified the template you'd like to work from, clone it into a directory with a name you'd like to assign to the new modified template.

coder templates pull <template-name> ./<new-template-name>

Then, you can make modifications to the existing template in this directory and push them to the control plane using the -d flag to specify the directory.

coder templates push <new-template-name> -d ./<new-template-name>

You will then see your new template in the dashboard.

From scratch (advanced)

There may be cases where you want to create a template from scratch. You can use any Terraform provider with Coder to create templates for additional clouds (e.g. Hetzner, Alibaba) or orchestrators (VMware, Proxmox) that we do not provide example templates for.

Refer to the following resources:

Next steps