|
1 |
| ---- |
2 |
| -# generated by https://github.com/hashicorp/terraform-plugin-docs |
3 |
| -page_title:"coder_parameter Data Source - terraform-provider-coder" |
4 |
| -subcategory:"" |
5 |
| -description:|- |
6 |
| - Use this data source to configure editable options for workspaces. |
7 |
| ---- |
8 |
| - |
9 |
| -#coder_parameter (Data Source) |
10 |
| - |
11 |
| -Use this data source to configure editable options for workspaces. |
12 |
| - |
13 |
| -##Example Usage |
14 |
| - |
15 |
| -```terraform |
16 |
| -provider "coder" {} |
17 |
| -
|
18 |
| -data "coder_parameter" "example" { |
19 |
| - name = "Region" |
20 |
| - description = "Specify a region to place your workspace." |
21 |
| - mutable = false |
22 |
| - type = "string" |
23 |
| - default = "us-central1-a" |
24 |
| - option { |
25 |
| - value = "us-central1-a" |
26 |
| - name = "US Central" |
27 |
| - icon = "/icons/1f1fa-1f1f8.png" |
28 |
| - } |
29 |
| - option { |
30 |
| - value = "asia-southeast1-a" |
31 |
| - name = "Singapore" |
32 |
| - icon = "/icons/1f1f8-1f1ec.png" |
33 |
| - } |
34 |
| -} |
35 |
| -
|
36 |
| -data "coder_parameter" "ami" { |
37 |
| - name = "Machine Image" |
38 |
| - description = <<-EOT |
39 |
| - # Provide the machine image |
40 |
| - See the [registry](https://container.registry.blah/namespace) for options. |
41 |
| - EOT |
42 |
| - option { |
43 |
| - value = "ami-xxxxxxxx" |
44 |
| - name = "Ubuntu" |
45 |
| - icon = "/icon/ubuntu.svg" |
46 |
| - } |
47 |
| -} |
48 |
| -
|
49 |
| -data "coder_parameter" "is_public_instance" { |
50 |
| - name = "Is public instance?" |
51 |
| - type = "bool" |
52 |
| - icon = "/icon/docker.svg" |
53 |
| - default = false |
54 |
| -} |
55 |
| -
|
56 |
| -data "coder_parameter" "cores" { |
57 |
| - name = "CPU Cores" |
58 |
| - type = "number" |
59 |
| - icon = "/icon/cpu.svg" |
60 |
| - default = 3 |
61 |
| - order = 10 |
62 |
| -} |
63 |
| -
|
64 |
| -data "coder_parameter" "disk_size" { |
65 |
| - name = "Disk Size" |
66 |
| - type = "number" |
67 |
| - default = "5" |
68 |
| - order = 8 |
69 |
| - validation { |
70 |
| - # This can apply to number. |
71 |
| - min = 0 |
72 |
| - max = 10 |
73 |
| - monotonic = "increasing" |
74 |
| - } |
75 |
| -} |
76 |
| -
|
77 |
| -data "coder_parameter" "cat_lives" { |
78 |
| - name = "Cat Lives" |
79 |
| - type = "number" |
80 |
| - default = "9" |
81 |
| - validation { |
82 |
| - # This can apply to number. |
83 |
| - min = 0 |
84 |
| - max = 10 |
85 |
| - monotonic = "decreasing" |
86 |
| - } |
87 |
| -} |
88 |
| -
|
89 |
| -data "coder_parameter" "fairy_tale" { |
90 |
| - name = "Fairy Tale" |
91 |
| - type = "string" |
92 |
| - mutable = true |
93 |
| - default = "Hansel and Gretel" |
94 |
| - ephemeral = true |
95 |
| -} |
96 |
| -
|
97 |
| -data "coder_parameter" "users" { |
98 |
| - name = "system_users" |
99 |
| - display_name = "System users" |
100 |
| - type = "list(string)" |
101 |
| - default = jsonencode(["root", "user1", "user2"]) |
102 |
| -} |
103 |
| -
|
104 |
| -data "coder_parameter" "home_volume_size" { |
105 |
| - name = "Home Volume Size" |
106 |
| - description = <<-EOF |
107 |
| - How large should your home volume be? |
108 |
| - EOF |
109 |
| - type = "number" |
110 |
| - default = 30 |
111 |
| - mutable = true |
112 |
| - order = 3 |
113 |
| -
|
114 |
| - option { |
115 |
| - name = "30GB" |
116 |
| - value = 30 |
117 |
| - } |
118 |
| -
|
119 |
| - option { |
120 |
| - name = "60GB" |
121 |
| - value = 60 |
122 |
| - } |
123 |
| -
|
124 |
| - option { |
125 |
| - name = "100GB" |
126 |
| - value = 100 |
127 |
| - } |
128 |
| -
|
129 |
| - validation { |
130 |
| - monotonic = "increasing" |
131 |
| - } |
132 |
| -} |
133 |
| -``` |
134 |
| - |
135 |
| -<!-- schema generated by tfplugindocs--> |
136 |
| -##Schema |
137 |
| - |
138 |
| -###Required |
139 |
| - |
140 |
| --`name` (String) The name of the parameter. If this is changed, developers will be re-prompted for a new value. |
141 |
| - |
142 |
| -###Optional |
143 |
| - |
144 |
| --`default` (String) A default value for the parameter. |
145 |
| --`description` (String) Describe what this parameter does. |
146 |
| --`display_name` (String) The displayed name of the parameter as it will appear in the interface. |
147 |
| --`ephemeral` (Boolean) The value of an ephemeral parameter will not be preserved between consecutive workspace builds. |
148 |
| --`form_type` (String) The type of this parameter. Must be one of:`"radio"`,`"slider"`,`"input"`,`"dropdown"`,`"checkbox"`,`"switch"`,`"multi-select"`,`"tag-select"`,`"textarea"`,`"error"`. |
149 |
| --`icon` (String) A URL to an icon that will display in the dashboard. View built-in icons[here](https://github.com/coder/coder/tree/main/site/static/icon). Use a built-in icon with`"${data.coder_workspace.me.access_url}/icon/<path>"`. |
150 |
| --`mutable` (Boolean) Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution! |
151 |
| --`option` (Block List) Each`option` block defines a value for a user to select from. (see[below for nested schema](#nestedblock--option)) |
152 |
| --`order` (Number) The order determines the position of a template parameter in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by name (ascending order). |
153 |
| --`styling` (String) JSON encoded string containing the metadata for controlling the appearance of this parameter in the UI. This option is purely cosmetic and does not affect the function of the parameter in terraform. |
154 |
| --`type` (String) The type of this parameter. Must be one of:`"string"`,`"number"`,`"bool"`,`"list(string)"`. |
155 |
| --`validation` (Block List, Max: 1) Validate the input of a parameter. (see[below for nested schema](#nestedblock--validation)) |
156 |
| - |
157 |
| -###Read-Only |
158 |
| - |
159 |
| --`id` (String) The ID of this resource. |
160 |
| --`optional` (Boolean) Whether this value is optional. |
161 |
| --`value` (String) The output value of the parameter. |
162 |
| - |
163 |
| -<aid="nestedblock--option"></a> |
164 |
| -###Nested Schema for`option` |
165 |
| - |
166 |
| -Required: |
167 |
| - |
168 |
| --`name` (String) The display name of this value in the UI. |
169 |
| --`value` (String) The value of this option set on the parameter if selected. |
170 |
| - |
171 |
| -Optional: |
172 |
| - |
173 |
| --`description` (String) Describe what selecting this value does. |
174 |
| --`icon` (String) A URL to an icon that will display in the dashboard. View built-in icons[here](https://github.com/coder/coder/tree/main/site/static/icon). Use a built-in icon with`"${data.coder_workspace.me.access_url}/icon/<path>"`. |
175 |
| - |
176 |
| - |
177 |
| -<aid="nestedblock--validation"></a> |
178 |
| -###Nested Schema for`validation` |
179 |
| - |
180 |
| -Optional: |
181 |
| - |
182 |
| --`error` (String) An error message to display if the value breaks the validation rules. The following placeholders are supported:`{max}`,`{min}`, and`{value}`. |
183 |
| --`max` (Number) The maximum value of a number parameter. |
184 |
| --`min` (Number) The minimum value of a number parameter. |
185 |
| --`monotonic` (String) Number monotonicity, either increasing or decreasing. |
186 |
| --`regex` (String) A regex for the input parameter to match against. |
187 |
| - |
188 |
| -Read-Only: |
189 |
| - |
190 |
| --`max_disabled` (Boolean) Helper field to check if`max` is present |
191 |
| --`min_disabled` (Boolean) Helper field to check if`min` is present |
| 1 | +--- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "coder_parameter Data Source - terraform-provider-coder" subcategory: "" description: |- Use this data source to configure editable options for workspaces. --- # coder_parameter (Data Source) Use this data source to configure editable options for workspaces. ## Example Usage ```terraform provider "coder" {} data "coder_parameter" "example" { name = "Region" description = "Specify a region to place your workspace." mutable = false type = "string" default = "us-central1-a" option { value = "us-central1-a" name = "US Central" icon = "/icons/1f1fa-1f1f8.png" } option { value = "asia-southeast1-a" name = "Singapore" icon = "/icons/1f1f8-1f1ec.png" } } data "coder_parameter" "ami" { name = "Machine Image" description = <<-EOT # Provide the machine image See the [registry](https://container.registry.blah/namespace) for options. EOT option { value = "ami-xxxxxxxx" name = "Ubuntu" icon = "/icon/ubuntu.svg" } } data "coder_parameter" "is_public_instance" { name = "Is public instance?" type = "bool" icon = "/icon/docker.svg" default = false } data "coder_parameter" "cores" { name = "CPU Cores" type = "number" icon = "/icon/cpu.svg" default = 3 order = 10 } data "coder_parameter" "disk_size" { name = "Disk Size" type = "number" default = "5" order = 8 validation { # This can apply to number. min = 0 max = 10 monotonic = "increasing" } } data "coder_parameter" "cat_lives" { name = "Cat Lives" type = "number" default = "9" validation { # This can apply to number. min = 0 max = 10 monotonic = "decreasing" } } data "coder_parameter" "fairy_tale" { name = "Fairy Tale" type = "string" mutable = true default = "Hansel and Gretel" ephemeral = true } data "coder_parameter" "users" { name = "system_users" display_name = "System users" type = "list(string)" default = jsonencode(["root", "user1", "user2"]) } data "coder_parameter" "home_volume_size" { name = "Home Volume Size" description = <<-EOF How large should your home volume be? EOF type = "number" default = 30 mutable = true order = 3 option { name = "30GB" value = 30 } option { name = "60GB" value = 60 } option { name = "100GB" value = 100 } validation { monotonic = "increasing" } } ``` <!-- schema generated by tfplugindocs --> ## Schema ### Required - `name` (String) The name of the parameter. If this is changed, developers will be re-prompted for a new value. ### Optional - `default` (String) A default value for the parameter. - `description` (String) Describe what this parameter does. - `display_name` (String) The displayed name of the parameter as it will appear in the interface. - `ephemeral` (Boolean) The value of an ephemeral parameter will not be preserved between consecutive workspace builds. - `form_type` (String) The type of this parameter. Must be one of: `"radio"`, `"slider"`, `"input"`, `"dropdown"`, `"checkbox"`, `"switch"`, `"multi-select"`, `"tag-select"`, `"textarea"`, `"error"`. - `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons [here](https://github.com/coder/coder/tree/main/site/static/icon). Use a built-in icon with `"${data.coder_workspace.me.access_url}/icon/<path>"`. - `mutable` (Boolean) Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution! - `option` (Block List) Each `option` block defines a value for a user to select from. (see [below for nested schema](#nestedblock--option)) - `order` (Number) The order determines the position of a template parameter in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by name (ascending order). - `styling` (String) JSON encoded string containing the metadata for controlling the appearance of this parameter in the UI. This option is purely cosmetic and does not affect the function of the parameter in terraform. - `type` (String) The type of this parameter. Must be one of: `"string"`, `"number"`, `"bool"`, `"list(string)"`. - `validation` (Block List, Max: 1) Validate the input of a parameter. (see [below for nested schema](#nestedblock--validation)) ### Read-Only - `id` (String) The ID of this resource. - `optional` (Boolean) Whether this value is optional. - `value` (String) The output value of the parameter. <a id="nestedblock--option"></a> ### Nested Schema for `option` Required: - `name` (String) The display name of this value in the UI. - `value` (String) The value of this option set on the parameter if selected. Optional: - `description` (String) Describe what selecting this value does. - `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons [here](https://github.com/coder/coder/tree/main/site/static/icon). Use a built-in icon with `"${data.coder_workspace.me.access_url}/icon/<path>"`. <a id="nestedblock--validation"></a> ### Nested Schema for `validation` Optional: - `error` (String) An error message to display if the value breaks the validation rules. The following placeholders are supported: `{max}`, `{min}`, and `{value}`. - `max` (Number) The maximum value of a number parameter. - `min` (Number) The minimum value of a number parameter. - `monotonic` (String) Number monotonicity, either increasing or decreasing. - `regex` (String) A regex for the input parameter to match against. Read-Only: - `max_disabled` (Boolean) Helper field to check if `max` is present - `min_disabled` (Boolean) Helper field to check if `min` is present |