Skip to content

docs: add new dynamic parameters information to parameters doc #17653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 19, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
examples out of table
  • Loading branch information
EdwardAngert committed May 19, 2025
commit bd613387805d143640f5de75d9110b3241ecebb7
63 changes: 32 additions & 31 deletions docs/admin/templates/extending-templates/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,13 @@ Dynamic Parameters enhances Coder's existing parameter system with real-time val
conditional parameter behavior, and richer input types.
This feature allows template authors to create more interactive and responsive workspace creation experiences.

### Enable Dynamic Parameters
### Enable Dynamic Parameters (Early Access)

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.
To use Dynamic Parameters, enable the experiment flag or set the environment variable.

<div class="tabs">
Note that as of v2.22.0, Dynamic parameters are an unsafe experiment and will not be enabled with the experiment wildcard.

<div class="tabs">

#### Flag

Expand All @@ -419,7 +420,9 @@ CODER_EXPERIMENTS=dynamic-parameters

</div>

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:
Dynamic Parameters also require version >=2.4.0 of the Coder provider.

Enable the experiment, then include the following at the top of your template:

```terraform
terraform {
Expand All @@ -432,7 +435,6 @@ terraform {
}
```


Once enabled, users can toggle between the experimental and classic interfaces during
workspace creation using an escape hatch in the workspace creation form.

Expand All @@ -451,8 +453,8 @@ Dynamic Parameters introduces three primary enhancements to the standard paramet

- Read user data at build time from [`coder_workspace_owner`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace_owner)
- Conditionally hide parameters based on user's role
- Change parameter options based on user groups
- Reference user name in parameters
- Change parameter options based on user groups
- Reference user name in parameters

- **Additional Form Inputs**

Expand All @@ -471,23 +473,23 @@ Different parameter types support different form types.

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).

| 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 > |
| `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 |
| `input` | `string`, `number` | No | Standard single-line text input field.<br>Default for string/number parameters without options. | placeholder |
| `key-value` | `string` | No | For entering key-value pairs (as JSON). | placeholder |
| `multi-select` | `list(string)` | Yes | Select multiple items from a list with checkboxes. | placeholder |
| `password` | `string` | No | Masked input field for sensitive information. | placeholder |
| `radio` | `string`, `number`, `bool`, `list(string)` | Yes | Radio buttons for selecting a single option with all choices visible at once. | placeholder |
| `slider` | `number` | No | Slider selection with min/max validation for numeric values. | placeholder |
| `switch` | `bool` | No | Toggle switch alternative for boolean parameters. | placeholder |
| `tag-select` | `list(string)` | No | Default for list(string) parameters without options. | placeholder |
| `textarea` | `string` | No | Multi-line text input field for longer content. | placeholder |
| Form Type | Parameter Types | Options | Notes |
|----------------|--------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------|
| `checkbox` | `bool` | No | A single checkbox for boolean parameters. Default for boolean parameters. |
| `dropdown` | `string`, `number` | Yes | Searchable dropdown list for choosing a single option from a list. Default for `string` or `number` parameters with options. |
| `input` | `string`, `number` | No | Standard single-line text input field. Default for string/number parameters without options. |
| `key-value` | `string` | No | For entering key-value pairs (as JSON). |
| `multi-select` | `list(string)` | Yes | Select multiple items from a list with checkboxes. |
| `password` | `string` | No | Masked input field for sensitive information. |
| `radio` | `string`, `number`, `bool`, `list(string)` | Yes | Radio buttons for selecting a single option with all choices visible at once. |
| `slider` | `number` | No | Slider selection with min/max validation for numeric values. |
| `switch` | `bool` | No | Toggle switch alternative for boolean parameters. |
| `tag-select` | `list(string)` | No | Default for list(string) parameters without options. |
| `textarea` | `string` | No | Multi-line text input field for longer content. | |

### Form Type Examples

<details><summary>checkbox: A single checkbox for boolean values</summary>
<details><summary>`checkbox`: A single checkbox for boolean values</summary>

```tf
data "coder_parameter" "enable_gpu" {
Expand All @@ -501,7 +503,7 @@ data "coder_parameter" "enable_gpu" {

</details>

<details><summary>dropdown: A searchable select menu for choosing a single option from a list</summary>
<details><summary>`dropdown`: A searchable select menu for choosing a single option from a list</summary>

```tf
data "coder_parameter" "region" {
Expand All @@ -524,7 +526,7 @@ data "coder_parameter" "region" {

</details>

<details><summary>input: A standard text input field</summary>
<details><summary>`input`: A standard text input field</summary>

```tf
data "coder_parameter" "custom_domain" {
Expand All @@ -538,7 +540,7 @@ data "coder_parameter" "custom_domain" {

</details>

<details><summary>key-value: Input for entering key-value pairs</summary>
<details><summary>`key-value`: Input for entering key-value pairs</summary>

```tf
data "coder_parameter" "environment_vars" {
Expand All @@ -552,7 +554,7 @@ data "coder_parameter" "environment_vars" {

</details>

<details><summary>multi-select: Checkboxes for selecting multiple options from a list</summary>
<details><summary>`multi-select`: Checkboxes for selecting multiple options from a list</summary>

```tf
data "coder_parameter" "tools" {
Expand All @@ -579,7 +581,7 @@ data "coder_parameter" "tools" {

</details>

<details><summary>password: A text input that masks sensitive information</summary>
<details><summary>`password`: A text input that masks sensitive information</summary>

```tf
data "coder_parameter" "api_key" {
Expand All @@ -593,7 +595,7 @@ data "coder_parameter" "api_key" {

</details>

<details><summary>radio: Radio buttons for selecting a single option with high visibility</summary>
<details><summary>`radio`: Radio buttons for selecting a single option with high visibility</summary>

```tf
data "coder_parameter" "environment" {
Expand All @@ -616,7 +618,7 @@ data "coder_parameter" "environment" {

</details>

<details><summary>slider: A slider for selecting numeric values within a range</summary>
<details><summary>`slider`: A slider for selecting numeric values within a range</summary>

```tf
data "coder_parameter" "cpu_cores" {
Expand All @@ -634,7 +636,7 @@ data "coder_parameter" "cpu_cores" {

</details>

<details><summary>switch: A toggle switch for boolean values</summary>
<details><summary>`switch`: A toggle switch for boolean values</summary>

```tf
data "coder_parameter" "advanced_mode" {
Expand All @@ -648,7 +650,7 @@ data "coder_parameter" "advanced_mode" {

</details>

<details><summary>textarea: A multi-line text input field for longer content</summary>
<details><summary>`textarea`: A multi-line text input field for longer content</summary>

```tf
data "coder_parameter" "init_script" {
Expand Down Expand Up @@ -934,4 +936,3 @@ data "coder_parameter" "cpu_count" {
```

</details>

Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy