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

Add must_change_password attribute to rancher2_user resource #1380

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

alegrey91
Copy link
Contributor

Issue: rancher/rancher#45736

Problem

When declaring users with rancher2_user, there is no option to ask the user to change their password on the next login like there is in the UI.

Solution

Add the missing attribute in order to allow the user to force the reset of rancher users managed with the provider.

Testing

Engineering Testing

Manual Testing

Setup a rancher instance from docker:

sudo docker run --privileged -it --rm -p 8080:80 -p 443:443 rancher/rancher

In order to test this new attribute I've used the following terraform script to ensure the new user had this attribute set:

resource "rancher2_user" "testuser" {
  name     = "Test User"
  username = "testuser"
  password = "password12345"
  must_change_password = true
  enabled     = true
}

# Assign global role bindings to the user (optional)
resource "rancher2_global_role_binding" "new_user_role" {
  user_id       = rancher2_user.testuser.id
  global_role_id = "user-base"
}

Once terraform completed its run, you can login with the new created user testuser.
Once logged in the UI will show the reset password page.

Automated Testing

QA Testing Considerations

Regressions Considerations

Copy link

@bigkevmcd bigkevmcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, I think there's a missing test tho'.

rancher2/resource_rancher2_user_test.go Show resolved Hide resolved
@alegrey91 alegrey91 requested a review from bigkevmcd August 5, 2024 08:43
@alegrey91 alegrey91 force-pushed the issue/45736 branch 5 times, most recently from 8be4e94 to 6439ff4 Compare August 5, 2024 14:17
…urce

Signed-off-by: Alessio Greggi <alessio.greggi@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants