Skip to content

Commit

Permalink
fix: [PL-57016]: Reverting v2 user group API changes since API is una…
Browse files Browse the repository at this point in the history
…vailable in all envs (#1061)
  • Loading branch information
niketan-nath authored Sep 13, 2024
1 parent 0971930 commit 5a7bb9d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions internal/service/platform/usergroup/usergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ func resourceUserGroupRead(ctx context.Context, d *schema.ResourceData, meta int
c, ctx := meta.(*internal.Session).GetPlatformClientWithContext(ctx)

id := d.Id()
ug := buildUserGroupV2(d)
resp, httpResp, err := c.UserGroupApi.GetUserGroupV2(ctx, c.AccountId, id, &nextgen.UserGroupApiGetUserGroupV2Opts{
// Migrate to GetUserGroupv2 once it is available in all environments including SMP customers
resp, httpResp, err := c.UserGroupApi.GetUserGroup(ctx, c.AccountId, id, &nextgen.UserGroupApiGetUserGroupOpts{
OrgIdentifier: helpers.BuildField(d, "org_id"),
ProjectIdentifier: helpers.BuildField(d, "project_id"),
})
Expand All @@ -181,7 +181,7 @@ func resourceUserGroupRead(ctx context.Context, d *schema.ResourceData, meta int
} else if attr1 {
d.Set("users", []string{})
}
readUserGroupV2(d, resp.Data, ug.Users)
readUserGroup(d, resp.Data)

return nil
}
Expand Down Expand Up @@ -430,9 +430,7 @@ func readUserGroupV2(d *schema.ResourceData, env *nextgen.UserGroupResponseV2, u
d.Set("name", env.Name)
d.Set("description", env.Description)
d.Set("tags", helpers.FlattenTags(env.Tags))
if _, ok := d.GetOk("users"); !ok {
d.Set("user_emails", ignoreOrderIfAllElementsMatch(user_emails, flattenUserInfo(env.Users)))
}
d.Set("user_emails", ignoreOrderIfAllElementsMatch(user_emails, flattenUserInfo(env.Users)))
d.Set("notification_configs", flattenNotificationConfig(env.NotificationConfigs))
d.Set("linked_sso_id", env.LinkedSsoId)
d.Set("linked_sso_display_name", env.LinkedSsoDisplayName)
Expand Down

0 comments on commit 5a7bb9d

Please sign in to comment.