You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Coder admins manage *templates* to define the infrastructure behind workspaces. A Coder deployment can have templates for different workloads.
4
+
5
+
## Managing templates
6
+
7
+
Coder provides production-ready template [examples](../examples/), but they can be modified with Terraform.
8
+
9
+
```sh
10
+
# start from an example
11
+
coder templates init
12
+
13
+
# optional: modify the template
14
+
vim <template-name>/main.tf
15
+
16
+
# add the template to Coder deployment
17
+
coder templates <create/update><template-name>
18
+
```
19
+
20
+
If you are commonly editing templates, we recommend source-controlling template code using GitOps/CI pipelines to make changes.
21
+
22
+
## Persistant and ephemeral resources
23
+
24
+
Coder supports ephemeral and persistant resources in workspaces. Ephemeral resources are be destroyed when a workspace is not in use (stopped). Persistant resources remain. See how this works for an example "frontend" template:
25
+
26
+
| Resource | Type |
27
+
| :--------------------------- | :--------- |
28
+
| google_compute_disk.home_dir | persistent |
29
+
| kubernetes_pod.dev | ephemeral |
30
+
| └─ nodejs (linux, amd64) ||
31
+
| api_token.backend | ephemeral |
32
+
33
+
When a workspace is deleted, all related resources are destroyed.
34
+
35
+
## Variables
36
+
37
+
Templates often contain *variables*. In Coder, there are two types of variables.
38
+
39
+
**Admin variables** are set when a template is being created/updated. These are often cloud secrets, such as a ServiceAccount token. These are annotated with `sensitive = true` in the template code.
40
+
41
+
**User variables** are set when a user creates a workspace. They are unique to each workspace, often personalization settings such as preferred region or workspace image.
0 commit comments