Skip to content

Commit 09c3ada

Browse files
authored
feat: add order to coder_parameter (#134)
1 parent cd41da2 commit 09c3ada

File tree

11 files changed

+14
-16
lines changed

11 files changed

+14
-16
lines changed

docs/data-sources/git_auth.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,3 @@ EOF
4646
### Read-Only
4747

4848
- `access_token` (String) The access token returned by the git authentication provider. This can be used to pre-authenticate command-line tools.
49-
50-

docs/data-sources/parameter.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Use this data source to configure editable options for workspaces.
2929
- `legacy_variable_name` (String, Deprecated) Name of the legacy Terraform variable. Coder will use it to lookup the variable value.
3030
- `mutable` (Boolean) Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution!
3131
- `option` (Block List, Max: 64) Each "option" block defines a value for a user to select from. (see [below for nested schema](#nestedblock--option))
32+
- `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).
3233
- `type` (String) The type of this parameter. Must be one of: "number", "string", "bool", or "list(string)".
3334
- `validation` (Block List, Max: 1) Validate the input of a parameter. (see [below for nested schema](#nestedblock--validation))
3435

@@ -67,5 +68,3 @@ Read-Only:
6768

6869
- `max_disabled` (Boolean) Helper field to check if max is present
6970
- `min_disabled` (Boolean) Helper field to check if min is present
70-
71-

docs/data-sources/provisioner.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ Use this data source to get information about the Coder provisioner.
2020
- `arch` (String) The architecture of the host. This exposes `runtime.GOARCH` (see https://pkg.go.dev/runtime#pkg-constants).
2121
- `id` (String) The ID of this resource.
2222
- `os` (String) The operating system of the host. This exposes `runtime.GOOS` (see https://pkg.go.dev/runtime#pkg-constants).
23-
24-

docs/data-sources/workspace.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ resource "kubernetes_pod" "dev" {
3737
- `owner_session_token` (String) Session token for interfacing with a Coder deployment. It is regenerated everytime a workspace is started.
3838
- `start_count` (Number) A computed count based on "transition" state. If "start", count will equal 1.
3939
- `transition` (String) Either "start" or "stop". Use this to start/stop resources with "count".
40-
41-

docs/resources/agent.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,3 @@ Optional:
7979

8080
- `display_name` (String) The user-facing name of this value.
8181
- `timeout` (Number) The maximum time the command is allowed to run in seconds.
82-
83-

docs/resources/agent_instance.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,3 @@ resource "coder_agent_instance" "dev" {
4040
### Read-Only
4141

4242
- `id` (String) The ID of this resource.
43-
44-

docs/resources/app.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,3 @@ Required:
9090
- `interval` (Number) Duration in seconds to wait between healthcheck requests.
9191
- `threshold` (Number) Number of consecutive heathcheck failures before returning an unhealthy status.
9292
- `url` (String) HTTP address used determine the application readiness. A successful health check is a HTTP response code less than 500 returned before healthcheck.interval seconds.
93-
94-

docs/resources/metadata.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,3 @@ Optional:
8080
Read-Only:
8181

8282
- `is_null` (Boolean)
83-
84-

examples/resources/coder_parameter/resource.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ data "coder_parameter" "cores" {
4545
type = "number"
4646
icon = "/icon/cpu.svg"
4747
default = 3
48+
order = 10
4849
}
4950

5051
data "coder_parameter" "disk_size" {
5152
name = "Disk Size"
5253
type = "number"
5354
default = "5"
55+
order = 8
5456
validation {
5557
# This can apply to number.
5658
min = 0

provider/parameter.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ type Parameter struct {
5757
Validation []Validation
5858
Optional bool
5959

60+
Order int
61+
6062
LegacyVariableName string `mapstructure:"legacy_variable_name"`
6163
LegacyVariable string `mapstructure:"legacy_variable"`
6264
}
@@ -90,6 +92,7 @@ func parameterDataSource() *schema.Resource {
9092
Option interface{}
9193
Validation interface{}
9294
Optional interface{}
95+
Order interface{}
9396

9497
LegacyVariableName interface{}
9598
LegacyVariable interface{}
@@ -122,6 +125,7 @@ func parameterDataSource() *schema.Resource {
122125
rd.Set("optional", val)
123126
return val
124127
}(),
128+
Order: rd.Get("order"),
125129
LegacyVariableName: rd.Get("legacy_variable_name"),
126130
LegacyVariable: rd.Get("legacy_variable"),
127131
}, &parameter)
@@ -331,6 +335,11 @@ func parameterDataSource() *schema.Resource {
331335
Computed: true,
332336
Description: "Whether this value is optional.",
333337
},
338+
"order": {
339+
Type: schema.TypeInt,
340+
Optional: true,
341+
Description: "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).",
342+
},
334343
"legacy_variable_name": {
335344
Type: schema.TypeString,
336345
Optional: true,

0 commit comments

Comments
 (0)
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