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

Privileges order change on every apply #10

Closed
ghost opened this issue Mar 20, 2020 · 5 comments · Fixed by #70
Closed

Privileges order change on every apply #10

ghost opened this issue Mar 20, 2020 · 5 comments · Fixed by #70
Assignees
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Mar 20, 2020

When creating role and applying set or privileges (as list of strings), updating nexus works.
But validation (or re-applying the same terraform config) causes nexus to be updated every time, as list of privileges comes in different order.

Example output from terraform:

  # module.project.nexus_role.nx-project will be updated in-place
  ~ resource "nexus_role" "nx-project" {
        description = "Project role"
        id          = "nx-project"
        name        = "nx-project"
      ~ privileges  = [
            "nx-repository-admin-maven2-common-public-snapshots-*",
            "nx-repository-admin-maven2-common-snapshots-*",
          + "nx-repository-admin-maven2-project-snapshots-*",
            "nx-repository-admin-maven2-project-public-snapshots-*",
          - "nx-repository-admin-maven2-project-releases-*",
          + "nx-repository-admin-maven2-common-public-releases-*",
            "nx-repository-admin-maven2-common-releases-*",
          - "nx-repository-admin-maven2-project-snapshots-*",
          + "nx-repository-admin-maven2-project-releases-*",
            "nx-repository-admin-maven2-project-public-releases-*",
          - "nx-repository-admin-maven2-common-public-releases-*",
        ]
        roleid      = "nx-project"
        roles       = []
    }

The privileges will be updated in place, but changes are irrelevant. Just an order.
But when one want to validate whether configuration is up to date (e.g. someone have not changed configuration manually), this will fail every time.

Possible solution would be to sort this list after fetching from nexus server, and sort it for validation/applying.

Similar issue might be with other list-related configurations, but I haven't check.

@ghost ghost changed the title Privileges order changes on every apply Privileges order change on every apply Mar 20, 2020
@Nosmoht
Copy link
Contributor

Nosmoht commented Mar 24, 2020

Hi @marek-budyn ,

i'll add sorting to the list. This should fix it.

@Nosmoht Nosmoht self-assigned this Mar 24, 2020
@Nosmoht Nosmoht added the bug Something isn't working label Mar 24, 2020
@ghost
Copy link
Author

ghost commented Mar 26, 2020

Thanks! this should help

Nosmoht added a commit that referenced this issue Apr 16, 2020
akaRem referenced this issue in akaRem/terraform-provider-nexus Apr 19, 2020
kuzmacska referenced this issue in akaRem/terraform-provider-nexus Apr 19, 2020
akaRem referenced this issue in akaRem/terraform-provider-nexus Apr 19, 2020
akaRem referenced this issue in akaRem/terraform-provider-nexus Apr 19, 2020
@Nosmoht Nosmoht closed this as completed in 2afdc05 May 5, 2020
@ghost
Copy link
Author

ghost commented May 14, 2020

Unfortunately latest release does the same. Still re-applying the same list of privileges.
It seems that this bug is not fixed and probably should be re-opened.

@ruedigerblock ruedigerblock reopened this May 18, 2020
@Michenux
Copy link

Not fixed for me.
It pollutes the output of terraform plan commands and it is more difficult to see real changes.

@Nosmoht
Copy link
Contributor

Nosmoht commented Jul 4, 2020

Hi all,

this is fixed with. cea995d

Nosmoht added a commit that referenced this issue Jul 4, 2020
@Nosmoht Nosmoht mentioned this issue Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants