Skip to content

Commit

Permalink
Merge pull request #831 from hashicorp/bugfix/user-show-address-list
Browse files Browse the repository at this point in the history
Bugfix: Only set `show_in_address_list` when changed in config as it is a potentially read-only attribute
  • Loading branch information
manicminer authored Jul 8, 2022
2 parents 5b29b4f + 135fd32 commit 0ef8635
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/services/users/user_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ func userResourceUpdate(ctx context.Context, d *schema.ResourceData, meta interf
PasswordPolicies: utils.NullableString(passwordPolicies),
PostalCode: utils.NullableString(d.Get("postal_code").(string)),
PreferredLanguage: utils.NullableString(d.Get("preferred_language").(string)),
ShowInAddressList: utils.Bool(d.Get("show_in_address_list").(bool)),
State: utils.NullableString(d.Get("state").(string)),
StreetAddress: utils.NullableString(d.Get("street_address").(string)),
Surname: utils.NullableString(d.Get("surname").(string)),
Expand Down Expand Up @@ -568,6 +567,10 @@ func userResourceUpdate(ctx context.Context, d *schema.ResourceData, meta interf
properties.OnPremisesImmutableId = utils.String(d.Get("onpremises_immutable_id").(string))
}

if d.HasChange("show_in_address_list") {
properties.ShowInAddressList = utils.Bool(d.Get("show_in_address_list").(bool))
}

if _, err := client.Update(ctx, properties); err != nil {
return tf.ErrorDiagF(err, "Could not update user with ID: %q", d.Id())
}
Expand Down

0 comments on commit 0ef8635

Please sign in to comment.