Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit09c3ada

Browse files
authored
feat: add order to coder_parameter (#134)
1 parentcd41da2 commit09c3ada

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` (seehttps://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` (seehttps://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
Optionalbool
5959

60+
Orderint
61+
6062
LegacyVariableNamestring`mapstructure:"legacy_variable_name"`
6163
LegacyVariablestring`mapstructure:"legacy_variable"`
6264
}
@@ -90,6 +92,7 @@ func parameterDataSource() *schema.Resource {
9092
Optioninterface{}
9193
Validationinterface{}
9294
Optionalinterface{}
95+
Orderinterface{}
9396

9497
LegacyVariableNameinterface{}
9598
LegacyVariableinterface{}
@@ -122,6 +125,7 @@ func parameterDataSource() *schema.Resource {
122125
rd.Set("optional",val)
123126
returnval
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,

‎provider/parameter_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TestParameter(t *testing.T) {
4343
icon = "/icon/east.svg"
4444
description = "Select for east!"
4545
}
46+
order = 5
4647
}
4748
`,
4849
Check:func(state*terraform.ResourceState) {
@@ -62,6 +63,7 @@ func TestParameter(t *testing.T) {
6263
"option.1.value":"us-east1-a",
6364
"option.1.icon":"/icon/east.svg",
6465
"option.1.description":"Select for east!",
66+
"order":"5",
6567
} {
6668
require.Equal(t,value,attrs[key])
6769
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp