Skip to content

Commit 29763b1

Browse files
chore(docs): add notes regarding provisioner tags and untagged jobs (coder#15081)
Relates to coder#15047 --------- Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
1 parent 75b5d71 commit 29763b1

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

docs/admin/provisioners.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,19 @@ coder templates push on-prem-chicago \
148148
--provisioner-tag datacenter=chicago
149149
```
150150

151+
This can also be done in the UI when building a template:
152+
153+
> ![template tags](../images/admin/provisioner-tags.png)
154+
151155
Alternatively, a template can target a provisioner via
152156
[workspace tags](https://github.com/coder/coder/tree/main/examples/workspace-tags)
153-
inside the Terraform.
157+
inside the Terraform. See the
158+
[workspace tags documentation](../admin/templates/extending-templates/workspace-tags.md)
159+
for more information.
160+
161+
> [!NOTE] Workspace tags defined with the `coder_workspace_tags` data source
162+
> template **do not** automatically apply to the template import job! You may
163+
> need to specify the desired tags when importing the template.
154164
155165
A provisioner can run a given build job if one of the below is true:
156166

@@ -170,6 +180,14 @@ However, it will not pick up any build jobs that do not have either of the
170180
`environment` or `datacenter` tags set. It will also not pick up any build jobs
171181
from templates with the tag `scope=user` set.
172182

183+
> [!NOTE] If you only run tagged provisioners, you will need to specify a set of
184+
> tags that matches at least one provisioner for _all_ template import jobs and
185+
> workspace build jobs.
186+
>
187+
> You may wish to run at least one additional provisioner with no additional
188+
> tags so that provisioner jobs with no additional tags defined will be picked
189+
> up instead of potentially remaining in the Pending state indefinitely.
190+
173191
This is illustrated in the below table:
174192

175193
| Provisioner Tags | Job Tags | Can Run Job? |

docs/admin/templates/extending-templates/workspace-tags.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ specified:
1717
```tf
1818
data "coder_workspace_tags" "custom_workspace_tags" {
1919
tags = {
20+
"az" = var.az
2021
"zone" = "developers"
2122
"runtime" = data.coder_parameter.runtime_selector.value
2223
"project_id" = "PROJECT_${data.coder_parameter.project_name.value}"
@@ -50,6 +51,9 @@ added that can handle its combination of tags.
5051
Before releasing the template version with configurable workspace tags, ensure
5152
that every tag set is associated with at least one healthy provisioner.
5253

54+
> [!NOTE] It may be useful to run at least one provisioner with no additional
55+
> tag restrictions that is able to take on any job.
56+
5357
### Parameters types
5458

5559
Provisioners require job tags to be defined in plain string format. When a
@@ -66,6 +70,16 @@ the workspace owner to change a provisioner group (due to different tags). In
6670
most cases, `coder_parameter`s backing `coder_workspace_tags` should be marked
6771
as immutable and set only once, during workspace creation.
6872

73+
We recommend using only the following as inputs for `coder_workspace_tags`:
74+
75+
| | Example |
76+
| :----------------- | :-------------------------------------------- |
77+
| Static values | `"developers"` |
78+
| Template variables | `var.az` |
79+
| Coder parameters | `data.coder_parameter.runtime_selector.value` |
80+
81+
Passing template tags in from other data sources may have undesired effects.
82+
6983
### HCL syntax
7084

7185
When importing the template version with `coder_workspace_tags`, the Coder
34.8 KB
Loading

0 commit comments

Comments
 (0)