Skip to content

Commit 0913594

Browse files
authored
docs: document workspace presets feature (coder#16612)
closes coder#16475 relates to coder#16304 - [x] reword opening sentence to clarify where this is done - I think this is set because it's under parameters now - [x] list of configurable settings - same as above - [x] (optional) screenshot [preview](https://coder.com/docs/@16475-workspace-presets/admin/templates/extending-templates/parameters#workspace-presets) --------- Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
1 parent 9251e0d commit 0913594

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

docs/admin/templates/extending-templates/parameters.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,62 @@ data "coder_parameter" "project_id" {
313313
}
314314
```
315315
316+
## Workspace presets
317+
318+
Workspace presets allow you to configure commonly used combinations of parameters
319+
into a single option, which makes it easier for developers to pick one that fits
320+
their needs.
321+
322+
![Template with options in the preset dropdown](../../../images/admin/templates/extend-templates/template-preset-dropdown.png)
323+
324+
Use `coder_workspace_preset` to define the preset parameters.
325+
After you save the template file, the presets will be available for all new
326+
workspace deployments.
327+
328+
<details><summary>Expand for an example</summary>
329+
330+
```tf
331+
data "coder_workspace_preset" "goland-gpu" {
332+
name = "GoLand with GPU"
333+
parameters = {
334+
"machine_type" = "n1-standard-1"
335+
"attach_gpu" = "true"
336+
"gcp_region" = "europe-west4-c"
337+
"jetbrains_ide" = "GO"
338+
}
339+
}
340+
341+
data "coder_parameter" "machine_type" {
342+
name = "machine_type"
343+
display_name = "Machine Type"
344+
type = "string"
345+
default = "n1-standard-2"
346+
}
347+
348+
data "coder_parameter" "attach_gpu" {
349+
name = "attach_gpu"
350+
display_name = "Attach GPU?"
351+
type = "bool"
352+
default = "false"
353+
}
354+
355+
data "coder_parameter" "gcp_region" {
356+
name = "gcp_region"
357+
display_name = "Machine Type"
358+
type = "string"
359+
default = "n1-standard-2"
360+
}
361+
362+
data "coder_parameter" "jetbrains_ide" {
363+
name = "jetbrains_ide"
364+
display_name = "Machine Type"
365+
type = "string"
366+
default = "n1-standard-2"
367+
}
368+
```
369+
370+
</details>
371+
316372
## Create Autofill
317373
318374
When the template doesn't specify default values, Coder may still autofill

0 commit comments

Comments
 (0)