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
Coder v2.24.0 introduces Dynamic Parameters to extend the existing parameter system with conditional form controls, enriched input types, and user idenitity awareness.
4
-
This feature allows template authors to create interactive workspace creation forms, meaning more environment customization and fewer templates to maintain.
3
+
Coder v2.24.0 introduces Dynamic Parameters to extend the existing parameter system with conditional form controls, enriched input types, and user idenitity awareness.
4
+
This feature allows template authors to create interactive workspace creation forms, meaning more environment customization and fewer templates to maintain.
5
5
6
-
All parameters are parsed from Terraform, meaning your workspace creation forms live in the same location as your provisioning code. You can use all the native Terraform functions and conditionality to create a self-service tooling catalog for every template.
6
+
All parameters are parsed from Terraform, meaning your workspace creation forms live in the same location as your provisioning code. You can use all the native Terraform functions and conditionality to create a self-service tooling catalog for every template.
7
7
8
8
Administrators can now:
9
9
10
10
- Create parameters which respond to the inputs of others
11
11
- Only show parameters when other input criteria is met
12
12
- Only show select parameters to target Coder roles or groups
13
13
14
-
You can try the dynamic parameter syntax and any of the code examples below in the [Parameters Playground](https://playground.coder.app/parameters) today. We advise experimenting here before upgrading templates.
14
+
You can try the dynamic parameter syntax and any of the code examples below in the [Parameters Playground](https://playground.coder.app/parameters) today. We advise experimenting here before upgrading templates.
15
15
16
16
### When you should upgrade to Dynamic Parameters
17
17
@@ -25,13 +25,13 @@ There are three reasons for users to try Dynamic Parameters:
25
25
- You want to selectively expose privledged workspace options to admins, power users, or personas
26
26
- You want to make the workspace creation flow more ergonomic for developers.
27
27
28
-
Dynamic Parameters help you reduce template duplication by setting conditions on which users may see which parameters. They increase the potential complexity of user-facing configuration by allowing administrators to organize a long list of options into interactive, branching paths for workspace customization. They allow you to set resource guardrails by referencing coder identity in the `coder_workspace_owner` data source.
28
+
Dynamic Parameters help you reduce template duplication by setting conditions on which users may see which parameters. They increase the potential complexity of user-facing configuration by allowing administrators to organize a long list of options into interactive, branching paths for workspace customization. They allow you to set resource guardrails by referencing coder identity in the `coder_workspace_owner` data source.
29
29
30
30
Read on for setup steps and code examples.
31
31
32
32
### How to enable Dynamic Parameters
33
33
34
-
In v2.24.0, you can opt-in to Dynamic Parameters on a per-template basis. To use dynamic parameters, go to your template settings and toggle the "Enable Dynamic Parameters Beta" option.
34
+
In v2.24.0, you can opt-in to Dynamic Parameters on a per-template basis. To use dynamic parameters, go to your template settings and toggle the "Enable Dynamic Parameters Beta" option.
35
35
36
36
[Image of template settings with dynamic parameters beta option]
37
37
@@ -106,6 +106,8 @@ The "Options" column in the table below indicates whether the form type requires
106
106
107
107
### New Form Types
108
108
109
+
The [`form_type`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/parameter#form_type-1) attribute can be used to select from a variety of form controls. See the following examples for usage in the [Parameters Playground](https://playground.coder.app/parameters).
110
+
109
111
<tabs>
110
112
111
113
## Dropdown lists
@@ -146,11 +148,91 @@ data "coder_parameter" "ides_dropdown" {
146
148
```
147
149
148
150
149
-
## Large text entry
151
+
## Text area
152
+
153
+
The large text entry option can be used to enter long strings like AI prompts, scripts, or natural language.
154
+
155
+
[Try textarea parameters on the Parameter Playground](https://playground.coder.app/parameters/RCAHA1Oi1_)
156
+
157
+
158
+
```terraform
159
+
160
+
data "coder_parameter" "text_area" {
161
+
name = "text_area"
162
+
description = "Enter mutli-line text."
163
+
mutable = true
164
+
display_name = "Select mutliple IDEs"
165
+
166
+
form_type = "textarea"
167
+
type = "string"
168
+
169
+
default = <<-EOT
170
+
This is an example of mult-line text entry.
171
+
172
+
The 'textarea' form_type is useful for
173
+
- AI prompts
174
+
- Scripts
175
+
- Read-only info (try the 'disabled' styling option)
176
+
EOT
177
+
}
178
+
179
+
```
150
180
151
181
## Multi-select
152
182
183
+
Multi-select parameters allow users to select one or many options from a single list of options. For example, adding multiple IDEs with a single parameter.
184
+
185
+
[Try multi-select parameters on the Parameter Playground](https://playground.coder.app/parameters/XogX54JV_f)
186
+
187
+
```terraform
188
+
locals {
189
+
ides = [
190
+
"VS Code", "JetBrains IntelliJ",
191
+
"GoLand", "WebStorm",
192
+
"Vim", "Emacs",
193
+
"Neovim", "PyCharm",
194
+
"Databricks", "Jupyter Notebook",
195
+
]
196
+
}
197
+
198
+
data "coder_parameter" "ide_selector" {
199
+
name = "ide_selector"
200
+
description = "Choose any IDEs for your workspace."
201
+
mutable = true
202
+
display_name = "Select mutliple IDEs"
203
+
204
+
205
+
# Allows users to select multiple IDEs from the list.
206
+
form_type = "multi-select"
207
+
type = "list(string)"
208
+
209
+
210
+
dynamic "option" {
211
+
for_each = local.ides
212
+
content {
213
+
name = option.value
214
+
value = option.value
215
+
}
216
+
}
217
+
}
218
+
```
219
+
220
+
## Checkboxes
221
+
222
+
223
+
Checkbox: A single checkbox for boolean values
153
224
225
+
[Try checkbox parameters on the playground](https://playground.coder.app/parameters/ycWuQJk2Py)
226
+
227
+
```terraform
228
+
data "coder_parameter" "enable_gpu" {
229
+
name = "enable_gpu"
230
+
display_name = "Enable GPU"
231
+
type = "bool"
232
+
form_type = "checkbox" # This is the default for boolean parameters
233
+
default = false
234
+
}
235
+
```
154
236
155
237
</tabs>
156
238
@@ -160,6 +242,19 @@ data "coder_parameter" "ides_dropdown" {
160
242
161
243
<tabs>
162
244
245
+
## Conditionally hide parameters
246
+
247
+
```terraform
248
+
249
+
250
+
```
251
+
252
+
253
+
## Dynamic Defaults
254
+
255
+
256
+
##
257
+
163
258
164
259
165
260
</tabs>
@@ -172,24 +267,15 @@ data "coder_parameter" "ides_dropdown" {
172
267
173
268
## Role-specific options
174
269
175
-
##
270
+
## Groups as namespaces
176
271
177
272
</tabs>
178
273
179
274
180
275
### Form Type Examples
181
276
182
-
<details><summary>checkbox: A single checkbox for boolean values</summary>
277
+
<details><summary></summary>
183
278
184
-
```tf
185
-
data "coder_parameter" "enable_gpu" {
186
-
name = "enable_gpu"
187
-
display_name = "Enable GPU"
188
-
type = "bool"
189
-
form_type = "checkbox" # This is the default for boolean parameters
0 commit comments