Skip to content

Commit

Permalink
Update cloudconnexa_user resource
Browse files Browse the repository at this point in the history
  • Loading branch information
sahaqaa committed Aug 2, 2024
1 parent 8259223 commit cd16e95
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cloudconnexa/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, m interface{}
func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
c := m.(*cloudconnexa.Client)
var diags diag.Diagnostics
if !d.HasChanges("first_name", "last_name", "group_id", "email") {
if !d.HasChanges("first_name", "last_name", "group_id", "email", "role") {
return diags
}

Expand All @@ -174,8 +174,8 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, m interface
_, firstName := d.GetChange("first_name")
_, lastName := d.GetChange("last_name")
_, role := d.GetChange("role")
status := u.Status
_, groupId := d.GetChange("group_id")
status := u.Status

err = c.Users.Update(cloudconnexa.User{
Id: d.Id(),
Expand All @@ -187,7 +187,11 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, m interface
Status: status,
})

return append(diags, diag.FromErr(err)...)
if err != nil {
return append(diags, diag.FromErr(err)...)
}

return diags
}

func resourceUserDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
Expand Down

0 comments on commit cd16e95

Please sign in to comment.