Skip to content

Commit d73abd0

Browse files
committed
example of prebuild
1 parent b24deaf commit d73abd0

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,57 @@ Workspace presets allow you to select settings tailored to your most common deve
319319
320320
Coder admins can configure workspace presets with combinations of parameter values and workspace settings within each template's Terraform file, and workspace users can customize their configurations as they need to.
321321
322+
Use `coder_workspace_preset` to define the preset parameters.
323+
You can use prebuilt workspaces to ensure that workspaces can be deployed within one minute.
324+
Use `prebuilds` to define how many instances of the template should be stored as a prebuilt workspace.
325+
When a developer selects the associated template, the workspace will be assigned to that developer and the server will build a new prebuilt workspace.
326+
327+
<details><summary>Expand for an example</summary>
328+
```tf
329+
data "coder_workspace_preset" "goland-gpu" {
330+
name = "GoLand with GPU"
331+
parameters = {
332+
"machine_type" = "n1-standard-1"
333+
"attach_gpu" = "true"
334+
"gcp_region" = "europe-west4-c"
335+
"jetbrains_ide" = "GO"
336+
}
337+
prebuilds {
338+
instances = 1
339+
}
340+
}
341+
342+
data "coder_parameter" "machine_type" {
343+
name = "machine_type"
344+
display_name = "Machine Type"
345+
type = "string"
346+
default = "n1-standard-2"
347+
}
348+
349+
data "coder_workspace_preset" "attach_gpu" {
350+
name = "attach_gpu"
351+
display_name = "Attach GPU?"
352+
type = "bool"
353+
default = "false"
354+
}
355+
356+
data "coder_workspace_preset" "gcp_region" {
357+
name = "gcp_region"
358+
display_name = "Machine Type"
359+
type = "string"
360+
default = "n1-standard-2"
361+
}
362+
363+
data "coder_workspace_preset" "jetbrains_ide" {
364+
name = "jetbrains_ide"
365+
display_name = "Machine Type"
366+
type = "string"
367+
default = "n1-standard-2"
368+
}
369+
```
370+
371+
</details>
372+
322373
## Create Autofill
323374
324375
When the template doesn't specify default values, Coder may still autofill

0 commit comments

Comments
 (0)