Terraform-provider-nexus: Privileges order change on every apply

Created on 20 Mar 2020  ·  5Comments  ·  Source: datadrivers/terraform-provider-nexus

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.

bug

All 5 comments

Hi @marek-budyn ,

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

Thanks! this should help

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.

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

Was this page helpful?
0 / 5 - 0 ratings