Skip to content

Commit 89d6e51

Browse files
authored
Allow clearing user group users (#137)
1 parent 14b3ec3 commit 89d6e51

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

internal/provider/user_group_resource.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -352,21 +352,19 @@ func (r *userGroupResource) Update(ctx context.Context, req resource.UpdateReque
352352
for _, member := range plan.Members {
353353
members = append(members, member.ValueString())
354354
}
355-
if len(members) > 0 {
356-
_, body, err = r.client.IAMGroupsAPI.ReplaceUsersInUserGroup(r.authContext, config.ID.ValueString()).ReplaceUsersInUserGroupV1Input(api.ReplaceUsersInUserGroupV1Input{
357-
Emails: members,
358-
}).Execute()
359-
if body != nil {
360-
defer body.Body.Close()
361-
}
362-
if err != nil {
363-
resp.Diagnostics.AddError(
364-
"Unable to add users/invites to User Group",
365-
getError(err, body),
366-
)
355+
_, body, err = r.client.IAMGroupsAPI.ReplaceUsersInUserGroup(r.authContext, config.ID.ValueString()).ReplaceUsersInUserGroupV1Input(api.ReplaceUsersInUserGroupV1Input{
356+
Emails: members,
357+
}).Execute()
358+
if body != nil {
359+
defer body.Body.Close()
360+
}
361+
if err != nil {
362+
resp.Diagnostics.AddError(
363+
"Unable to add users/invites to User Group",
364+
getError(err, body),
365+
)
367366

368-
return
369-
}
367+
return
370368
}
371369

372370
getOut, body, err := r.client.IAMGroupsAPI.GetUserGroup(r.authContext, config.ID.ValueString()).Execute()

0 commit comments

Comments
 (0)