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 source parameter to user resource #475

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Edu-DevOps
Copy link

Issue detailed here: #371 (comment)

In a nutshell, without the source parameter two users (one local and one LDAP) can collide using the same userid.

I've updated documentation and run tests successfully.

This is a test done in a local environment:

Terraform will perform the following actions:

  # nexus_security_user.test will be created
  + resource "nexus_security_user" "test" {
      + email     = "[email protected]"
      + firstname = "Test"
      + id        = (known after apply)
      + lastname  = "User"
      + password  = (sensitive value)
      + roles     = [
          + "nx-admin",
        ]
      **+ source    = "default"**
      + status    = "active"
      + userid    = "test-user"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
2024-10-18T14:39:44.953+0200 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

And this is a state show of the object

terraform state show nexus_security_user.test
# nexus_security_user.test:
resource "nexus_security_user" "test" {
    email     = "[email protected]"
    firstname = "Test"
    id        = "test-user"
    lastname  = "User"
    password  = (sensitive value)
    roles     = [
        "nx-admin",
    ]
    source    = "default"
    status    = "active"
    userid    = "test-user"
}

Taken advantage of the PR I've fixed the examples/local-development/main.tf file which was using a resource that doesn't exist

Optional: true,
ValidateFunc: validation.StringInSlice([]string{
"default",
"LDAP",
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont have an LDAP setup to test against at this time, but i suspect you cannot create LDAP users in this way? When i try to create a user with source LDAP, the api returns a user with source "default".

If it is not possible to create LDAP users this way, I would suggest removing the possibility to set the source here, or the possiblity to set anything other than default.

Copy link
Author

Choose a reason for hiding this comment

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

That's actually right, LDAP users aren't created by Nexus in this way. I'll remove the posibility to set other than default just in case in the future another source spawns in a Nexus release.

Copy link
Author

Choose a reason for hiding this comment

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

Addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants