Skip to content

Commit 6189a91

Browse files
committed
feat: add owner group to workspace data
1 parent ec5b604 commit 6189a91

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

docs/data-sources/workspace.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ resource "kubernetes_pod" "dev" {
3232
- `name` (String) Name of the workspace.
3333
- `owner` (String) Username of the workspace owner.
3434
- `owner_email` (String) Email address of the workspace owner.
35+
- `owner_groups` (List of String) List of groups the workspace owner belongs to.
3536
- `owner_id` (String) UUID of the workspace owner.
3637
- `owner_name` (String) Name of the workspace owner.
3738
- `owner_oidc_access_token` (String) A valid OpenID Connect access token of the workspace owner. This is only available if the workspace owner authenticated with OpenID Connect. If a valid token cannot be obtained, this value will be an empty string.

provider/workspace.go

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ func workspaceDataSource() *schema.Resource {
3636
ownerEmail := os.Getenv("CODER_WORKSPACE_OWNER_EMAIL")
3737
_ = rd.Set("owner_email", ownerEmail)
3838

39+
ownerGroups := os.Getenv("CODER_WORKSPACE_OWNER_GROUPS")
40+
_ = rd.Set("owner_groups", ownerGroups)
41+
3942
ownerName := os.Getenv("CODER_WORKSPACE_OWNER_NAME")
4043
_ = rd.Set("owner_name", ownerName)
4144

@@ -141,6 +144,11 @@ func workspaceDataSource() *schema.Resource {
141144
"This is only available if the workspace owner authenticated with OpenID Connect. " +
142145
"If a valid token cannot be obtained, this value will be an empty string.",
143146
},
147+
"owner_groups": {
148+
Type: schema.TypeList,
149+
Computed: true,
150+
Description: "List of groups the workspace owner belongs to. ",
151+
},
144152
"id": {
145153
Type: schema.TypeString,
146154
Computed: true,

0 commit comments

Comments
 (0)