Skip to content

User being recreated does not always force role to be reassigned #125

@stephanerenou

Description

@stephanerenou

If I change the password of a user, it gets recreated, but then the grant role does not always detect that it needs to grant the role to the new user, so we end up with a user without role.

With a code like this
resource "random_password" "password" {
length = 16
min_lower = 1
min_upper = 1
min_numeric = 1
min_special = 1
special = true
override_special = "!#$%&*()-_=+[]{}<>:?"
}

resource "clickhousedbops_user" "my_user" {
name = var.user_name
password_sha256_hash_wo = sha256(random_password.password.result)
password_sha256_hash_wo_version = 5
}

resource "clickhousedbops_grant_role" "role_to_user" {
role_name = clickhousedbops_role.my_user_role.name
grantee_user_name = clickhousedbops_user.my_user.name
admin_option = false
}

If you bump the password version, the user gets recreated on first terraform apply, and if you trigger another terraform apply it would detect that it needs to regrant the role.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions