Skip to content

Commit 43eadc6

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

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

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)
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