Skip to content

Commit

Permalink
fix update jc user display name
Browse files Browse the repository at this point in the history
  • Loading branch information
cheelim1 committed Apr 16, 2024
1 parent 460b91d commit cd69aa5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions jumpcloud/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,16 @@ func resourceUserUpdate(d *schema.ResourceData, m interface{}) error {
}

// Dynamically set the display name if there's a change
if d.HasChange("display_name") {
if displayName, ok := d.GetOk("display_name"); ok {
payload.Displayname = displayName.(string)
} else {
payload.Displayname = "" // Clear display name if not provided in the config
}
}
if d.HasChange("display_name") {
_, ok := d.GetOk("display_name")
if !ok {
// The attribute was removed from the configuration, so we explicitly clear it.
payload.Displayname = ""
} else {
// The attribute has a new value.
payload.Displayname = d.Get("display_name").(string)
}
}

req := map[string]interface{}{
"body": payload,
Expand Down

0 comments on commit cd69aa5

Please sign in to comment.