Skip to content

Commit 06cf760

Browse files
committedApr 4, 2025
Allow presets to define 0 parameters
1 parent 4e37a00 commit 06cf760

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

Diff for: ‎provider/workspace_preset.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func workspacePresetDataSource() *schema.Resource {
6464
"parameters": {
6565
Type: schema.TypeMap,
6666
Description: "Parameters of the workspace preset.",
67-
Required: true,
67+
Optional: true,
6868
Elem: &schema.Schema{
6969
Type: schema.TypeString,
7070
Required: true,

Diff for: ‎provider/workspace_preset_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func TestWorkspacePreset(t *testing.T) {
8484
}`,
8585
// This validation is done by Terraform, but it could still break if we misconfigure the schema.
8686
// So we test it here to make sure we don't regress.
87-
ExpectError: regexp.MustCompile("The argument \"parameters\" is required, but no definition was found"),
87+
ExpectError: nil,
8888
},
8989
{
9090
Name: "Parameters field is empty",
@@ -95,7 +95,7 @@ func TestWorkspacePreset(t *testing.T) {
9595
}`,
9696
// This validation is *not* done by Terraform, because MinItems doesn't work with maps.
9797
// We've implemented the validation in ReadContext, so we test it here to make sure we don't regress.
98-
ExpectError: regexp.MustCompile("expected \"parameters\" to not be an empty map"),
98+
ExpectError: nil,
9999
},
100100
{
101101
Name: "Parameters field is not a map",

0 commit comments

Comments
 (0)