Skip to content

Commit f046a3a

Browse files
committed
make list
1 parent 6189a91 commit f046a3a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

provider/workspace.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ func workspaceDataSource() *schema.Resource {
145145
"If a valid token cannot be obtained, this value will be an empty string.",
146146
},
147147
"owner_groups": {
148-
Type: schema.TypeList,
148+
Type: schema.TypeList,
149+
Elem: &schema.Schema{
150+
Type: schema.TypeString,
151+
},
149152
Computed: true,
150153
Description: "List of groups the workspace owner belongs to. ",
151154
},

provider/workspace_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func TestWorkspace(t *testing.T) {
1616
t.Setenv("CODER_WORKSPACE_OWNER_NAME", "Mr Owner")
1717
t.Setenv("CODER_WORKSPACE_OWNER_EMAIL", "[email protected]")
1818
t.Setenv("CODER_WORKSPACE_OWNER_SESSION_TOKEN", "abc123")
19+
t.Setenv("CODER_WORKSPACE_OWNER_GROUPS", "[ \"group1\", \"group2\" ]")
1920
t.Setenv("CODER_WORKSPACE_TEMPLATE_ID", "templateID")
2021
t.Setenv("CODER_WORKSPACE_TEMPLATE_NAME", "template123")
2122
t.Setenv("CODER_WORKSPACE_TEMPLATE_VERSION", "v1.2.3")
@@ -47,6 +48,7 @@ func TestWorkspace(t *testing.T) {
4748
require.Equal(t, "Mr Owner", attribs["owner_name"])
4849
require.Equal(t, "[email protected]", attribs["owner_email"])
4950
require.Equal(t, "abc123", attribs["owner_session_token"])
51+
require.Equal(t, "[ \"group1\", \"group2\" ]", attribs["owner_groups"])
5052
require.Equal(t, "templateID", attribs["template_id"])
5153
require.Equal(t, "template123", attribs["template_name"])
5254
require.Equal(t, "v1.2.3", attribs["template_version"])
@@ -80,6 +82,7 @@ func TestWorkspace(t *testing.T) {
8082
require.Equal(t, "owner123", attribs["owner"])
8183
require.Equal(t, "Mr Owner", attribs["owner_name"])
8284
require.Equal(t, "[email protected]", attribs["owner_email"])
85+
require.Equal(t, "[ \"group1\", \"group2\" ]", attribs["owner_groups"])
8386
require.Equal(t, "templateID", attribs["template_id"])
8487
require.Equal(t, "template123", attribs["template_name"])
8588
require.Equal(t, "v1.2.3", attribs["template_version"])

0 commit comments

Comments
 (0)