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/dynamic-parameters.md
+108-7Lines changed: 108 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -104,13 +104,13 @@ The "Options" column in the table below indicates whether the form type requires
104
104
105
105
### New Form Types
106
106
107
-
The following examples show some basic usage of the sing the [`form_type`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/parameter#form_type-1) attribute explained above.
107
+
The following examples show some basic usage of the [`form_type`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/parameter#form_type-1) attribute explained above. These are used to change the input style of form controls in the create workspace form.
108
108
109
109
<divclass="tabs">
110
110
111
111
### Dropdowns
112
112
113
-
All single-select parameters with options may now use the `form_type=\"dropdown\"` attribute for better organization.
113
+
Single-select parameters with options may now use the `form_type=\"dropdown\"` attribute for better organization.
114
114
115
115
[Try dropdown lists on the Parameter Playground](https://playground.coder.app/parameters/kgNBpjnz7x)
116
116
@@ -284,6 +284,30 @@ data "coder_parameter" "cpu_cores" {
284
284
}
285
285
```
286
286
287
+
<!-- ### Secrets
288
+
289
+
Sliders can be used for configuration on a linear scale, like resource allocation. The `validation` block is used to clamp the minimum and maximum values for the parameter.
290
+
291
+
[Try secret parameters on the Parameters Playground](https://playground.coder.app/parameters/wmiP7FM3Za).
292
+
293
+
```terraform
294
+
data "coder_parameter" "private_api_key" {
295
+
name = "private_api_key"
296
+
display_name = "Your super secret API key"
297
+
type = "string"
298
+
299
+
form_type = "input" # | "textarea"
300
+
301
+
# Will render as "**********"
302
+
default = "privatekey"
303
+
304
+
styling = jsonencode({
305
+
maskInput = true
306
+
})
307
+
}
308
+
``` -->
309
+
310
+
287
311
</div>
288
312
289
313
### Conditional Parameters
@@ -315,7 +339,6 @@ data "coder_parameter" "show_cpu_cores" {
315
339
order = 1
316
340
}
317
341
318
-
319
342
data "coder_parameter" "cpu_cores" {
320
343
# Only show this parameter if the previous box is selected.
@@ -337,9 +360,20 @@ data "coder_parameter" "cpu_cores" {
337
360
338
361
For a given parameter, we can influence which option is selected by default based on the selection of another. This allows us to suggest an option dynamically without strict enforcement.
339
362
340
-
[Try dynamic defaults in the Parameter Playground](https://playground.coder.app/parameters/Ilko59tf89).
363
+
[Try dynamic defaults in the Parameter Playground](https://playground.coder.app/parameters/DEi-Bi6DVe).
@@ -393,7 +427,6 @@ Parameters' validation block can also leverage inputs from other parameters.
393
427
394
428
[Try dynamic validation in the Parameter Playground](https://playground.coder.app/parameters/sdbzXxagJ4).
395
429
396
-
397
430
```terraform
398
431
data "coder_parameter" "git_repo" {
399
432
name = "git_repo"
@@ -441,8 +474,76 @@ data "coder_parameter" "cpu_cores" {
441
474
442
475
## Daisy Chaining
443
476
444
-
```
477
+
You can daisy-chain the conditionals shown here to create a dynamically expanding form. Note that parameters must be indexed when using the `count` attribute.
0 commit comments