Skip to content

Commit ebce4ce

Browse files
authored
fix: check if owner groups exist before marshaling (#205)
1 parent 176fb6a commit ebce4ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

provider/workspace.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ func workspaceDataSource() *schema.Resource {
3939

4040
ownerGroupsText := os.Getenv("CODER_WORKSPACE_OWNER_GROUPS")
4141
var ownerGroups []string
42-
err := json.Unmarshal([]byte(ownerGroupsText), &ownerGroups)
43-
if err != nil {
44-
return diag.Errorf("couldn't parse owner groups %q", ownerGroupsText)
42+
if ownerGroupsText != "" {
43+
err := json.Unmarshal([]byte(ownerGroupsText), &ownerGroups)
44+
if err != nil {
45+
return diag.Errorf("couldn't parse owner groups %q", ownerGroupsText)
46+
}
4547
}
4648
_ = rd.Set("owner_groups", ownerGroups)
4749

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy