1
1
---
2
2
title : Templates
3
- description :
4
- Learn how to create an embeddable "Open In Coder" button for your Workspaces
5
- As Code Template
3
+ description : Learn how to manage your Workspaces as Code Templates.
6
4
---
7
5
8
6
The ** Templates** tab features options that control the behavior of workspace
@@ -14,56 +12,70 @@ located in Git repositories.
14
12
15
13
![ Enable workspace templates] ( ../assets/enable-ws-templates.png )
16
14
17
- ## Template policy (alpha)
15
+ ## Template policy
16
+
17
+ > Template policies are currently an ** alpha** feature.
18
18
19
19
If you enable the use of workspace templates, a ** template policy** allows you
20
- to control which fields users can set and which values can be used when they
21
- define their workspaces.
20
+ to control which fields users can set and which values can they can use when
21
+ defining their workspaces.
22
+
23
+ Users can apply the following policies to fields:
24
+
25
+ - ` read ` - ** Default.** Workspaces cannot modify the field
26
+ - ` write ` - Workspaces can overwrite the field
27
+ - ` append ` - Workspaces can append lists (e.g., configure.start steps) or
28
+ mappings to the field
22
29
23
30
The default template policy is as follows:
24
31
25
32
``` yaml
26
33
version : " 0.2"
27
34
workspace :
28
- configure :
29
- start :
30
- policy : write
31
- dev-urls :
35
+ configure :
36
+ start :
37
+ policy : write
38
+ dev-urls :
39
+ policy : write
40
+ specs :
41
+ kubernetes :
42
+ container-based-vm :
43
+ policy : write
44
+ cpu :
45
+ policy : write
46
+ disk :
32
47
policy : write
33
- specs :
34
- kubernetes :
35
- container-based-vm :
36
- policy : write
37
- cpu :
38
- policy : write
39
- disk :
40
- policy : write
41
- env :
42
- policy : write
43
- gpu-count :
44
- policy : write
45
- image :
46
- policy : write
47
- labels :
48
- policy : read
49
- memory :
50
- policy : write
51
- node-selector :
52
- policy : read
53
- tolerations :
54
- policy : read
48
+ env :
49
+ policy : write
50
+ gpu-count :
51
+ policy : write
52
+ image :
53
+ policy : write
54
+ labels :
55
+ policy : read
56
+ memory :
57
+ policy : write
58
+ node-selector :
59
+ policy : read
60
+ tolerations :
61
+ policy : read
55
62
` ` `
56
63
57
- Underneath the policy template preview, you can either upload your policy or you
58
- can drag-and-drop the file onto the UI. Click **Save** to persist your changes.
64
+ Underneath the policy template preview, you can either upload your policy or
65
+ drag-and-drop the file onto the UI. Click **Save** to persist your changes.
59
66
60
67
If, at any time, you want to remove your policy and use Coder's default policy,
61
68
click **Reset to default**.
62
69
70
+ The template policy applies to all workspaces, including custom workspaces,
71
+ created and managed in Coder. If a workspace's properties conflict with the
72
+ template policy, Coder will ignore the workspace's values in favor of those
73
+ defined by the template policy.
74
+
63
75
## Embeddable Button
64
76
65
- The Embeddable Button section features a form you can use for generating an embeddable
66
- button. This button makes it easy for developers to use your
77
+ The ** Embeddable Button** section features a form you can use for generating an
78
+ embeddable button. This button makes it easy for developers to use your
67
79
[workspace template](../workspaces/workspaces-as-code/index.md).
68
80
69
81
To create your button:
@@ -82,4 +94,4 @@ By default, workspaces as code is an opt-in feature. To enable workspaces as
82
94
code, go to **Admin > Templates** and set **Enable using Workspace Templates**
83
95
to **On**.
84
96
85
- 
97
+ 
0 commit comments