Skip to content

Commit

Permalink
bugfix: run d.Partial() to avoid setting invalid password to state wh…
Browse files Browse the repository at this point in the history
…en a user update fails
  • Loading branch information
manicminer committed May 15, 2024
1 parent 310ed13 commit 16c62b1
Showing 1 changed file with 5 additions and 0 deletions.
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

0 comments on commit 16c62b1

Please sign in to comment.