Skip to content

Commit aaa860c

Browse files
committed
Change to mutable
1 parent 12f02f7 commit aaa860c

File tree

5 files changed

+69
-10
lines changed

5 files changed

+69
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Terraform Provider Coder
1+
# terraform-provider-coder
22

3-
> This works with a closed-alpha of [Coder](https://coder.com). For access, contact [support@coder.com](mailto:support@coder.com).
3+
See [Coder](https://github.com/coder/coder).

docs/data-sources/parameter.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "coder_parameter Data Source - terraform-provider-coder"
4+
subcategory: ""
5+
description: |-
6+
Use this data source to configure editable options for workspaces.
7+
---
8+
9+
# coder_parameter (Data Source)
10+
11+
Use this data source to configure editable options for workspaces.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `name` (String) The name of the parameter as it will appear in the interface. If this is changed, developers will be re-prompted for a new value.
21+
22+
### Optional
23+
24+
- `default` (String) A default value for the parameter.
25+
- `description` (String) Describe what this parameter does.
26+
- `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons here: https://github.com/coder/coder/tree/main/site/static/icon. Use a built-in icon with `data.coder_workspace.me.access_url + "/icon/<path>"`.
27+
- `mutable` (Boolean) Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution!
28+
- `option` (Block List, Max: 64) Each "option" block defines a value for a user to select from. (see [below for nested schema](#nestedblock--option))
29+
- `type` (String) The type of this parameter. Must be one of: "number", "string", or "bool".
30+
- `validation` (Block List, Max: 1) Validate the input of a parameter. (see [below for nested schema](#nestedblock--validation))
31+
32+
### Read-Only
33+
34+
- `id` (String) The ID of this resource.
35+
- `value` (String) The output value of the parameter.
36+
37+
<a id="nestedblock--option"></a>
38+
### Nested Schema for `option`
39+
40+
Required:
41+
42+
- `name` (String) The display name of this value in the UI.
43+
- `value` (String) The value of this option set on the parameter if selected.
44+
45+
Optional:
46+
47+
- `description` (String) Describe what selecting this value does.
48+
- `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons here: https://github.com/coder/coder/tree/main/site/static/icon. Use a built-in icon with `data.coder_workspace.me.access_url + "/icon/<path>"`.
49+
50+
51+
<a id="nestedblock--validation"></a>
52+
### Nested Schema for `validation`
53+
54+
Optional:
55+
56+
- `max` (Number) The maximum of a number parameter.
57+
- `min` (Number) The minimum of a number parameter.
58+
- `regex` (String) A regex for the input parameter to match against.
59+
60+

examples/resources/coder_parameter/resource.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ data "coder_parameter" "cores" {
3838
data "coder_parameter" "disk_size" {
3939
display_name = "Disk Size"
4040
type = "number"
41-
increase_only = true
4241
validation {
4342
# This can apply to number and string types.
4443
min = 0

provider/parameter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Parameter struct {
3333
Name string
3434
Description string
3535
Type string
36-
Immutable bool
36+
Mutable bool
3737
Default string
3838
Icon string
3939
Option []Option
@@ -52,7 +52,7 @@ func parameterDataSource() *schema.Resource {
5252
Name interface{}
5353
Description interface{}
5454
Type interface{}
55-
Immutable interface{}
55+
Mutable interface{}
5656
Default interface{}
5757
Icon interface{}
5858
Option interface{}
@@ -62,7 +62,7 @@ func parameterDataSource() *schema.Resource {
6262
Name: rd.Get("name"),
6363
Description: rd.Get("description"),
6464
Type: rd.Get("type"),
65-
Immutable: rd.Get("immutable"),
65+
Mutable: rd.Get("mutable"),
6666
Default: rd.Get("default"),
6767
Icon: rd.Get("icon"),
6868
Option: rd.Get("option"),
@@ -139,10 +139,10 @@ func parameterDataSource() *schema.Resource {
139139
ValidateFunc: validation.StringInSlice([]string{"number", "string", "bool"}, false),
140140
Description: `The type of this parameter. Must be one of: "number", "string", or "bool".`,
141141
},
142-
"immutable": {
142+
"mutable": {
143143
Type: schema.TypeBool,
144144
Optional: true,
145-
Default: true,
145+
Default: false,
146146
Description: "Whether this value can be changed after workspace creation. This can be destructive for values like region, so use with caution!",
147147
},
148148
"default": {

provider/parameter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ data "coder_parameter" "region" {
2525
name = "Region"
2626
type = "string"
2727
description = "Some option!"
28-
immutable = false
28+
mutable = true
2929
icon = "/icon/region.svg"
3030
option {
3131
name = "US Central"
@@ -47,7 +47,7 @@ data "coder_parameter" "region" {
4747
"name": "Region",
4848
"type": "string",
4949
"description": "Some option!",
50-
"immutable": "false",
50+
"mutable": "true",
5151
"icon": "/icon/region.svg",
5252
"option.0.name": "US Central",
5353
"option.0.value": "us-central1-a",

0 commit comments

Comments
 (0)