Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: run d.Partial() to avoid setting invalid password to state when a user update fails #1379

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/services/users/user_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,11 @@ func userResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta int
}

if _, err := client.Update(ctx, properties); err != nil {
// Flag the state as 'partial' to avoid setting `password` from the current config. Since the config is the
// only source for this property, if the update fails due to a bad password, the current password will be forgotten
// and Terraform will not offer a diff in the next plan.
d.Partial(true) //lintignore:R007

return tf.ErrorDiagF(err, "Could not update user with ID: %q", d.Id())
}

Expand Down
Loading