Skip to content

feat: add order to coder_parameter #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/data-sources/git_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ EOF
### Read-Only

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


3 changes: 1 addition & 2 deletions docs/data-sources/parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Use this data source to configure editable options for workspaces.
- `legacy_variable_name` (String, Deprecated) Name of the legacy Terraform variable. Coder will use it to lookup the variable value.
- `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, Max: 64) Each "option" block defines a value for a user to select from. (see [below for nested schema](#nestedblock--option))
- `priority` (Number) The priority of template parameters determines their position ahead of parameters with lower priorities in the UI/CLI presentation.
- `type` (String) The type of this parameter. Must be one of: "number", "string", "bool", or "list(string)".
- `validation` (Block List, Max: 1) Validate the input of a parameter. (see [below for nested schema](#nestedblock--validation))

Expand Down Expand Up @@ -67,5 +68,3 @@ Read-Only:

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


2 changes: 0 additions & 2 deletions docs/data-sources/provisioner.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ Use this data source to get information about the Coder provisioner.
- `arch` (String) The architecture of the host. This exposes `runtime.GOARCH` (see https://pkg.go.dev/runtime#pkg-constants).
- `id` (String) The ID of this resource.
- `os` (String) The operating system of the host. This exposes `runtime.GOOS` (see https://pkg.go.dev/runtime#pkg-constants).


2 changes: 0 additions & 2 deletions docs/data-sources/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ resource "kubernetes_pod" "dev" {
- `owner_session_token` (String) Session token for interfacing with a Coder deployment. It is regenerated everytime a workspace is started.
- `start_count` (Number) A computed count based on "transition" state. If "start", count will equal 1.
- `transition` (String) Either "start" or "stop". Use this to start/stop resources with "count".


2 changes: 0 additions & 2 deletions docs/resources/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,3 @@ Optional:

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


2 changes: 0 additions & 2 deletions docs/resources/agent_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@ resource "coder_agent_instance" "dev" {
### Read-Only

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


2 changes: 0 additions & 2 deletions docs/resources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,3 @@ Required:
- `interval` (Number) Duration in seconds to wait between healthcheck requests.
- `threshold` (Number) Number of consecutive heathcheck failures before returning an unhealthy status.
- `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.


2 changes: 0 additions & 2 deletions docs/resources/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,3 @@ Optional:
Read-Only:

- `is_null` (Boolean)


16 changes: 9 additions & 7 deletions examples/resources/coder_parameter/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ data "coder_parameter" "is_public_instance" {
}

data "coder_parameter" "cores" {
name = "CPU Cores"
type = "number"
icon = "/icon/cpu.svg"
default = 3
name = "CPU Cores"
type = "number"
icon = "/icon/cpu.svg"
default = 3
priority = 10
}

data "coder_parameter" "disk_size" {
name = "Disk Size"
type = "number"
default = "5"
name = "Disk Size"
type = "number"
default = "5"
priority = 8
validation {
# This can apply to number.
min = 0
Expand Down
9 changes: 9 additions & 0 deletions provider/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type Parameter struct {
Validation []Validation
Optional bool

Priority int

LegacyVariableName string `mapstructure:"legacy_variable_name"`
LegacyVariable string `mapstructure:"legacy_variable"`
}
Expand Down Expand Up @@ -90,6 +92,7 @@ func parameterDataSource() *schema.Resource {
Option interface{}
Validation interface{}
Optional interface{}
Priority interface{}

LegacyVariableName interface{}
LegacyVariable interface{}
Expand Down Expand Up @@ -122,6 +125,7 @@ func parameterDataSource() *schema.Resource {
rd.Set("optional", val)
return val
}(),
Priority: rd.Get("priority"),
LegacyVariableName: rd.Get("legacy_variable_name"),
LegacyVariable: rd.Get("legacy_variable"),
}, &parameter)
Expand Down Expand Up @@ -331,6 +335,11 @@ func parameterDataSource() *schema.Resource {
Computed: true,
Description: "Whether this value is optional.",
},
"priority": {
Type: schema.TypeInt,
Optional: true,
Description: "The priority of template parameters determines their position ahead of parameters with lower priorities in the UI/CLI presentation.",
},
"legacy_variable_name": {
Type: schema.TypeString,
Optional: true,
Expand Down