Skip to content

Commit d81eec6

Browse files
committed
feat: add priority to coder_parameter
1 parent cd41da2 commit d81eec6

File tree

10 files changed

+19
-23
lines changed

10 files changed

+19
-23
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+
- `priority` (Number) The priority of template parameters determines their position ahead of parameters with lower priorities in the UI/CLI presentation.
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: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ data "coder_parameter" "is_public_instance" {
4141
}
4242

4343
data "coder_parameter" "cores" {
44-
name = "CPU Cores"
45-
type = "number"
46-
icon = "/icon/cpu.svg"
47-
default = 3
44+
name = "CPU Cores"
45+
type = "number"
46+
icon = "/icon/cpu.svg"
47+
default = 3
48+
priority = 10
4849
}
4950

5051
data "coder_parameter" "disk_size" {
51-
name = "Disk Size"
52-
type = "number"
53-
default = "5"
52+
name = "Disk Size"
53+
type = "number"
54+
default = "5"
55+
priority = 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+
Priority 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+
Priority 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+
Priority: rd.Get("priority"),
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+
"priority": {
339+
Type: schema.TypeInt,
340+
Optional: true,
341+
Description: "The priority of template parameters determines their position ahead of parameters with lower priorities in the UI/CLI presentation.",
342+
},
334343
"legacy_variable_name": {
335344
Type: schema.TypeString,
336345
Optional: true,

0 commit comments

Comments
 (0)