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

Order of repositories in docker repository group is not respected #339

Closed
1 task done
xgcssch opened this issue Jan 23, 2023 · 9 comments · Fixed by #427
Closed
1 task done

Order of repositories in docker repository group is not respected #339

xgcssch opened this issue Jan 23, 2023 · 9 comments · Fixed by #427
Assignees
Labels
bug Something isn't working

Comments

@xgcssch
Copy link

xgcssch commented Jan 23, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.3.7

Nexus Provider Version

1.21.2

Nexus Version

3.37.3

Affected Resource(s)/Data Source(s)

nexus_repository_docker_group

Terraform Configuration Files

resource "nexus_repository_docker_hosted" docker-hosted-repos-rfrg {
  name   = "docker-h-rfrg"
  online = true
  docker {
    force_basic_auth = false
    v1_enabled       = false
    https_port       = 5001
  }
  storage {
    blob_store_name                = "TransientData"
    strict_content_type_validation = true
  }
}

resource "nexus_repository_docker_hosted" docker-hosted-repos-rint {
  name   = "docker-h-rint"
  online = true
  docker {
    force_basic_auth = false
    v1_enabled       = false
    https_port       = 5002
  }
  storage {
    blob_store_name                = "TransientData"
    strict_content_type_validation = true
  }
}

resource "nexus_repository_docker_hosted" docker-hosted-repos-rewt {
  name   = "docker-h-rewt"
  online = true
  docker {
    force_basic_auth = false
    v1_enabled       = false
    https_port       = 5003
  }
  storage {
    blob_store_name                = "TransientData"
    strict_content_type_validation = true
  }
}

resource "nexus_repository_docker_group" docker-group-repos {
  name   = "docker-g-rewt"
  online = true
  docker {
    force_basic_auth = false
    v1_enabled       = false
    https_port       = 5023
  }
  group {
        member_names     = [
          nexus_repository_docker_hosted.docker-hosted-repos-rewt.name,
          nexus_repository_docker_hosted.docker-hosted-repos-rint.name,
          nexus_repository_docker_hosted.docker-hosted-repos-rfrg.name,
          ]
  }
  storage {
    blob_store_name                = "TransientData"
    strict_content_type_validation = true
  }
}

Debug Output/Panic Output

omitted

Expected Behaviour

Final order in Nexus after applying

docker-h-rewt
docker-h-rint
docker-h-rfrg

Actual Behaviour

Final order in Nexus after applying

docker-h-rint
docker-h-rfrg
docker-h-rewt

Funny: in the Terraform difference output the order is different too:

  # nexus_repository_docker_group.docker-group-repos will be created
  + resource "nexus_repository_docker_group" "docker-group-repos" {
      + id     = (known after apply)
      + name   = "docker-g-rewt"
      + online = true

      + docker {
          + force_basic_auth = false
          + https_port       = 5023
          + v1_enabled       = false
        }

      + group {
          + member_names = [
              + "docker-h-rewt",
              + "docker-h-rfrg",
              + "docker-h-rint",
            ]
        }

      + storage {
          + blob_store_name                = "TransientData"
          + strict_content_type_validation = true
        }
    }

Steps to Reproduce

terraform apply

References

#25 or #140

@bkolanko
Copy link

It's the same bug for the other type of groups, like npm and maven.

@joeyaurel joeyaurel self-assigned this Jan 11, 2024
@joeyaurel
Copy link

I can confirm that this problem still exists. Looking into it.

@Edu-DevOps
Copy link

I´ve checked this and the issue seems to be in this schema attribute since TypeSet is used to represent an unordered collection of items. Terraform doc reference: https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-types#typeset

We would need to use TypeList to preserver the order I believe

@salakonrad
Copy link

The problem still exists in the latest provider version

@sonykus
Copy link

sonykus commented Feb 12, 2024

I can confirm that the problem still exists in version 2.1.0 of the datadriver, and this also affects ALL kind of groups (not just docker). The underlying issue was well pointed out in the comments above:
The datadriver implementation uses a set, not a list, and therefore the ordered input gets reshuffled along the way.

Environment (although irrelevant due to the nature of this bug): Terraform 1.7.1 and Nexus RM Pro 3.62.0-01.

@anmoel
Copy link
Member

anmoel commented Mar 4, 2024

first, it is only fixed for docker groups

@anmoel anmoel reopened this Mar 4, 2024
@anmoel
Copy link
Member

anmoel commented Mar 4, 2024

we will implement the same way for all repository types if someone can approve that the problem is fixed in version https://github.com/datadrivers/terraform-provider-nexus/releases/tag/v2.2.0

@oliverisaac
Copy link
Contributor

The merged PR applies to the base repository schema so it applied to all repository types.

This is working as expected for an npm repo:

  • I applied the terraform
  • I logged into my instance and altered the group member order using the GUI
  • I reapplied the terraform
  • The GUI shows that my manual order change was reverted and the ordering is now as desired

@nickreynke nickreynke assigned nickreynke and unassigned joeyaurel Jun 13, 2024
@anmoel
Copy link
Member

anmoel commented Aug 8, 2024

the issue looks closed. please open again if not so

@anmoel anmoel closed this as completed Aug 8, 2024
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.

9 participants