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
Copy file name to clipboardExpand all lines: docs/admin/templates/extending-templates/parameters.md
+32-31Lines changed: 32 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -398,12 +398,13 @@ Dynamic Parameters enhances Coder's existing parameter system with real-time val
398
398
conditional parameter behavior, and richer input types.
399
399
This feature allows template authors to create more interactive and responsive workspace creation experiences.
400
400
401
-
### Enable Dynamic Parameters
401
+
### Enable Dynamic Parameters (Early Access)
402
402
403
-
To use Dynamic Parameters, enable the experiment flag or set the environment variable. Note that as of v.22.0, Dynamic parameters are an _unsafe_ experiment and will not be enabled by using the experiment wildcard.
403
+
To use Dynamic Parameters, enable the experiment flag or set the environment variable.
404
404
405
-
<div class="tabs">
405
+
Note that as of v2.22.0, Dynamic parameters are an unsafe experiment and will not be enabled with the experiment wildcard.
Dynamic Parameters also require version >=2.4.0 of the coder provider. Inject the following at the top of your template after enabling the experiment:
423
+
Dynamic Parameters also require version >=2.4.0 of the Coder provider.
424
+
425
+
Enable the experiment, then include the following at the top of your template:
423
426
424
427
```terraform
425
428
terraform {
@@ -432,7 +435,6 @@ terraform {
432
435
}
433
436
```
434
437
435
-
436
438
Once enabled, users can toggle between the experimental and classic interfaces during
437
439
workspace creation using an escape hatch in the workspace creation form.
438
440
@@ -451,8 +453,8 @@ Dynamic Parameters introduces three primary enhancements to the standard paramet
451
453
452
454
- Read user data at build time from [`coder_workspace_owner`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace_owner)
453
455
- Conditionally hide parameters based on user's role
454
-
- Change parameter options based on user groups
455
-
- Reference user name in parameters
456
+
- Change parameter options based on user groups
457
+
- Reference user name in parameters
456
458
457
459
- **Additional Form Inputs**
458
460
@@ -471,23 +473,23 @@ Different parameter types support different form types.
471
473
472
474
The "Options" column in the table below indicates whether the form type requires options to be defined (Yes) or doesn't support/require them (No). When required, options are specified using one or more `option` blocks in your parameter definition, where each option has a `name` (displayed to the user) and a `value` (used in your template logic).
473
475
474
-
| Form Type | Parameter Types | Options | Notes | Example |
| `checkbox` | `bool` | No | A single checkbox for boolean parameters.<br>Default for boolean parameters. | <details><summary>checkbox</summary> ``` tf data "coder_parameter" "enable_gpu" { name = "enable_gpu" display_name = "Enable GPU" type = "bool" form_type = "checkbox" # This is the default for boolean parameters default = false } ``` </ details > |
477
-
| `dropdown` | `string`, `number` | Yes | Searchable dropdown list for choosing a single option from a list.<br>Default for `string` or `number` parameters with options. | placeholder |
478
-
| `input` | `string`, `number` | No | Standard single-line text input field.<br>Default for string/number parameters without options. | placeholder |
479
-
| `key-value` | `string` | No | For entering key-value pairs (as JSON). | placeholder |
480
-
| `multi-select` | `list(string)` | Yes | Select multiple items from a list with checkboxes. | placeholder |
481
-
| `password` | `string` | No | Masked input field for sensitive information. | placeholder |
482
-
| `radio` | `string`, `number`, `bool`, `list(string)` | Yes | Radio buttons for selecting a single option with all choices visible at once. | placeholder
E29B
|
483
-
| `slider` | `number` | No | Slider selection with min/max validation for numeric values. | placeholder |
484
-
| `switch` | `bool` | No | Toggle switch alternative for boolean parameters. | placeholder |
485
-
| `tag-select` | `list(string)` | No | Default for list(string) parameters without options. | placeholder |
486
-
| `textarea` | `string` | No | Multi-line text input field for longer content. | placeholder |
| `checkbox` | `bool` | No | A single checkbox for boolean parameters.Default for boolean parameters. |
479
+
| `dropdown` | `string`, `number` | Yes | Searchable dropdown list for choosing a single option from a list.Default for `string` or `number` parameters with options. |
480
+
| `input` | `string`, `number` | No | Standard single-line text input field.Default for string/number parameters without options. |
481
+
| `key-value` | `string` | No | For entering key-value pairs (as JSON). |
482
+
| `multi-select` | `list(string)` | Yes | Select multiple items from a list with checkboxes. |
483
+
| `password` | `string` | No | Masked input field for sensitive information. |
484
+
| `radio` | `string`, `number`, `bool`, `list(string)` | Yes | Radio buttons for selecting a single option with all choices visible at once. |
485
+
| `slider` | `number` | No | Slider selection with min/max validation for numeric values. |
486
+
| `switch` | `bool` | No | Toggle switch alternative for boolean parameters. |
487
+
| `tag-select` | `list(string)` | No | Default for list(string) parameters without options. |
488
+
| `textarea` | `string` | No | Multi-line text input field for longer content. | |
487
489
488
490
### Form Type Examples
489
491
490
-
<details><summary>checkbox: A single checkbox for boolean values</summary>
492
+
<details><summary>`checkbox`: A single checkbox for boolean values</summary>
491
493
492
494
```tf
493
495
data "coder_parameter" "enable_gpu" {
@@ -501,7 +503,7 @@ data "coder_parameter" "enable_gpu" {
501
503
502
504
</details>
503
505
504
-
<details><summary>dropdown: A searchable select menu for choosing a single option from a list</summary>
506
+
<details><summary>`dropdown`: A searchable select menu for choosing a single option from a list</summary>
505
507
506
508
```tf
507
509
data "coder_parameter" "region" {
@@ -524,7 +526,7 @@ data "coder_parameter" "region" {
524
526
525
527
</details>
526
528
527
-
<details><summary>input: A standard text input field</summary>
529
+
<details><summary>`input`: A standard text input field</summary>
528
530
529
531
```tf
530
532
data "coder_parameter" "custom_domain" {
@@ -538,7 +540,7 @@ data "coder_parameter" "custom_domain" {
538
540
539
541
</details>
540
542
541
-
<details><summary>key-value: Input for entering key-value pairs</summary>
543
+
<details><summary>`key-value`: Input for entering key-value pairs</summary>
542
544
543
545
```tf
544
546
data "coder_parameter" "environment_vars" {
@@ -552,7 +554,7 @@ data "coder_parameter" "environment_vars" {
552
554
553
555
</details>
554
556
555
-
<details><summary>multi-select: Checkboxes for selecting multiple options from a list</summary>
557
+
<details><summary>`multi-select`: Checkboxes for selecting multiple options from a list</summary>
556
558
557
559
```tf
558
560
data "coder_parameter" "tools" {
@@ -579,7 +581,7 @@ data "coder_parameter" "tools" {
579
581
580
582
</details>
581
583
582
-
<details><summary>password: A text input that masks sensitive information</summary>
584
+
<details><summary>`password`: A text input that masks sensitive information</summary>
583
585
584
586
```tf
585
587
data "coder_parameter" "api_key" {
@@ -593,7 +595,7 @@ data "coder_parameter" "api_key" {
593
595
594
596
</details>
595
597
596
-
<details><summary>radio: Radio buttons for selecting a single option with high visibility</summary>
598
+
<details><summary>`radio`: Radio buttons for selecting a single option with high visibility</summary>
597
599
598
600
```tf
599
601
data "coder_parameter" "environment" {
@@ -616,7 +618,7 @@ data "coder_parameter" "environment" {
616
618
617
619
</details>
618
620
619
-
<details><summary>slider: A slider for selecting numeric values within a range</summary>
621
+
<details><summary>`slider`: A slider for selecting numeric values within a range</summary>
620
622
621
623
```tf
622
624
data "coder_parameter" "cpu_cores" {
@@ -634,7 +636,7 @@ data "coder_parameter" "cpu_cores" {
634
636
635
637
</details>
636
638
637
-
<details><summary>switch: A toggle switch for boolean values</summary>
639
+
<details><summary>`switch`: A toggle switch for boolean values</summary>
638
640
639
641
```tf
640
642
data "coder_parameter" "advanced_mode" {
@@ -648,7 +650,7 @@ data "coder_parameter" "advanced_mode" {
648
650
649
651
</details>
650
652
651
-
<details><summary>textarea: A multi-line text input field for longer content</summary>
653
+
<details><summary>`textarea`: A multi-line text input field for longer content</summary>
652
654
653
655
```tf
654
656
data "coder_parameter" "init_script" {
@@ -934,4 +936,3 @@ data "coder_parameter" "cpu_count" {
0 commit comments