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

harbor_user fails updating user role when using LDAP auth #316

Open
deepbrook opened this issue Apr 21, 2023 · 0 comments
Open

harbor_user fails updating user role when using LDAP auth #316

deepbrook opened this issue Apr 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@deepbrook
Copy link

When using LDAP as authentication method, users created by it may not be updated via PUT /users/<user_id>,
otherwise, a 409 is returned.

However, it's still allowed to set a user's role, specifically setting them as admin, as this uses a different
endpoint: /users/{user_id}/sysadmin.

In order to manage admin access, we have imported existing users - created via LDAP - into our harbor_user resource
blocks. The resource looks as follows:

resource "harbor_user" "admins" {
  full_name = var.user
  email     = "unmanaged"
  username  = "unmanaged"
  password  = "unmanaged"
  admin     = false
  lifecycle {
    ignore_changes = [password, full_name, email, comment]
  }
}

When changing the admin attribute to true, the change is correctly displayed in the plan - only the admin attribute has changes.

However, during the apply operation, the PUT /users/$user_id endpoint is still contacted, despite having no changes to report. The API does not know this, of course, and flat out rejects the update operation on the user (because it's an LDAP user).

expected behaviour

The provider should ignore the 409, as no changes need to be made and the response is irrelevant to the deployment.

Additonal Notes

I can deduce that handling this nicely is probably a difficult task. Since there are several APIs in play, it may be a good idea to separate the admin attribute from the harbor_user resource altogether. For example, in a harbor_user_admin resource block.

@flbla flbla added the bug Something isn't working label Jul 28, 2023
@flbla flbla added enhancement New feature or request and removed bug Something isn't working labels Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants