You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ to setup your local Terraform to use your local version rather than the registry
47
47
}
48
48
```
49
49
2. Run `terraform init` and observe a warning like `Warning: Provider development overrides are in effect`
50
-
4. Run `go build -o terraform-provider-coder` to build the provider binary, which Terraform will try locate and execute
50
+
4. Run `make build` to build the provider binary, which Terraform will try locate and execute
51
51
5. All local Terraform runs will now use your local provider!
52
52
6._**NOTE**: we vendor in this provider into `github.com/coder/coder`, so if you're testing with a local clone then you should also run `go mod edit -replace github.com/coder/terraform-provider-coder=/path/to/terraform-provider-coder` in your clone._
-`access_port` (Number) The access port of the Coder deployment provisioning this workspace.
70
70
-`access_url` (String) The access URL of the Coder deployment provisioning this workspace.
71
71
-`id` (String) UUID of the workspace.
72
+
-`is_prebuild` (Boolean) Similar to `prebuild_count`, but a boolean value instead of a count. This is set to true if the workspace is a currently unassigned prebuild. Once the workspace is assigned, this value will be false.
72
73
-`name` (String) Name of the workspace.
74
+
-`prebuild_count` (Number) A computed count, equal to 1 if the workspace is a currently unassigned prebuild. Use this to conditionally act on the status of a prebuild. Actions that do not require user identity can be taken when this value is set to 1. Actions that should only be taken once the workspace has been assigned to a user may be taken when this value is set to 0.
73
75
-`start_count` (Number) A computed count based on `transition` state. If `start`, count will equal 1.
74
76
-`template_id` (String) ID of the workspace's template.
75
77
-`template_name` (String) Name of the workspace's template.
Copy file name to clipboardExpand all lines: docs/data-sources/workspace_preset.md
+16-5
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,12 @@
3
3
page_title: "coder_workspace_preset Data Source - terraform-provider-coder"
4
4
subcategory: ""
5
5
description: |-
6
-
Use this data source to predefine common configurations for workspaces.
6
+
Use this data source to predefine common configurations for coder workspaces. Users will have the option to select a defined preset, which will automatically apply the selected configuration. Any parameters defined in the preset will be applied to the workspace. Parameters that are not defined by the preset will still be configurable when creating a workspace.
7
7
---
8
8
9
9
# coder_workspace_preset (Data Source)
10
10
11
-
Use this data source to predefine common configurations for workspaces.
11
+
Use this data source to predefine common configurations for coder workspaces. Users will have the option to select a defined preset, which will automatically apply the selected configuration. Any parameters defined in the preset will be applied to the workspace. Parameters that are not defined by the preset will still be configurable when creating a workspace.
12
12
13
13
## Example Usage
14
14
@@ -34,9 +34,20 @@ data "coder_workspace_preset" "example" {
34
34
35
35
### Required
36
36
37
-
-`name` (String) Name of the workspace preset.
38
-
-`parameters` (Map of String) Parameters of the workspace preset.
37
+
-`name` (String) The name of the workspace preset.
38
+
39
+
### Optional
40
+
41
+
-`parameters` (Map of String) Workspace parameters that will be set by the workspace preset. For simple templates that only need prebuilds, you may define a preset with zero parameters. Because workspace parameters may change between Coder template versions, preset parameters are allowed to define values for parameters that do not exist in the current template version.
42
+
-`prebuilds` (Block Set, Max: 1) Prebuilt workspace configuration related to this workspace preset. Coder will build and maintain workspaces in reserve based on this configuration. When a user creates a new workspace using a preset, they will be assigned a prebuilt workspace, instead of waiting for a new workspace to build. (see [below for nested schema](#nestedblock--prebuilds))
39
43
40
44
### Read-Only
41
45
42
-
-`id` (String) ID of the workspace preset.
46
+
-`id` (String) The preset ID is automatically generated and may change between runs. It is recommended to use the `name` attribute to identify the preset.
47
+
48
+
<aid="nestedblock--prebuilds"></a>
49
+
### Nested Schema for `prebuilds`
50
+
51
+
Required:
52
+
53
+
-`instances` (Number) The number of workspaces to keep in reserve for this preset.
Description: "The access port of the Coder deployment provisioning this workspace.",
85
93
},
94
+
"prebuild_count": {
95
+
Type: schema.TypeInt,
96
+
Computed: true,
97
+
Description: "A computed count, equal to 1 if the workspace is a currently unassigned prebuild. Use this to conditionally act on the status of a prebuild. Actions that do not require user identity can be taken when this value is set to 1. Actions that should only be taken once the workspace has been assigned to a user may be taken when this value is set to 0.",
Description: "Similar to `prebuild_count`, but a boolean value instead of a count. This is set to true if the workspace is a currently unassigned prebuild. Once the workspace is assigned, this value will be false.",
Description: "Use this data source to predefine common configurations for workspaces.",
26
+
Description: "Use this data source to predefine common configurations for coder workspaces. Users will have the option to select a defined preset, which will automatically apply the selected configuration. Any parameters defined in the preset will be applied to the workspace. Parameters that are not defined by the preset will still be configurable when creating a workspace.",
// MinItems doesn't work with maps, so we need to check the length
36
-
// of the map manually. All other validation is handled by the
37
-
// schema.
38
-
iflen(preset.Parameters) ==0 {
39
-
returndiag.Errorf("expected \"parameters\" to not be an empty map")
40
-
}
41
-
42
48
rd.SetId(preset.Name)
43
49
44
50
returnnil
45
51
},
46
52
Schema: map[string]*schema.Schema{
47
53
"id": {
48
54
Type: schema.TypeString,
49
-
Description: "ID of the workspace preset.",
55
+
Description: "The preset ID is automatically generated and may change between runs. It is recommended to use the `name` attribute to identify the preset.",
50
56
Computed: true,
51
57
},
52
58
"name": {
53
59
Type: schema.TypeString,
54
-
Description: "Name of the workspace preset.",
60
+
Description: "The name of the workspace preset.",
55
61
Required: true,
56
62
ValidateFunc: validation.StringIsNotEmpty,
57
63
},
58
64
"parameters": {
59
65
Type: schema.TypeMap,
60
-
Description: "Parameters of the workspace preset.",
61
-
Required: true,
66
+
Description: "Workspace parameters that will be set by the workspace preset. For simple templates that only need prebuilds, you may define a preset with zero parameters. Because workspace parameters may change between Coder template versions, preset parameters are allowed to define values for parameters that do not exist in the current template version.",
67
+
Optional: true,
62
68
Elem: &schema.Schema{
63
69
Type: schema.TypeString,
64
70
Required: true,
65
71
ValidateFunc: validation.StringIsNotEmpty,
66
72
},
67
73
},
74
+
"prebuilds": {
75
+
Type: schema.TypeSet,
76
+
Description: "Prebuilt workspace configuration related to this workspace preset. Coder will build and maintain workspaces in reserve based on this configuration. When a user creates a new workspace using a preset, they will be assigned a prebuilt workspace, instead of waiting for a new workspace to build.",
77
+
Optional: true,
78
+
MaxItems: 1,
79
+
Elem: &schema.Resource{
80
+
Schema: map[string]*schema.Schema{
81
+
"instances": {
82
+
Type: schema.TypeInt,
83
+
Description: "The number of workspaces to keep in reserve for this preset.",
0 commit comments