terraform-provider-nexus icon indicating copy to clipboard operation
terraform-provider-nexus copied to clipboard

Creating m2 group with `version_policy = "SNAPSHOT"` produces a group repo with version policy as `Release`

Open mykelalvis-rialtic opened this issue 3 years ago • 5 comments

Describe the bug terraform plan tells me the following as part of the attached TF files run (this is a subset)

  # nexus_repository.op2-snapshot-group-m2 will be created
  + resource "nexus_repository" "op2-snapshot-group-m2" {
      + format = "maven2"
      + id     = (known after apply)
      + name   = "op2-snapshot-group-m2"
      + online = true
      + type   = "group"

      + group {
          + member_names = [
              + "op2-release-group-m2",
              + "op2-snapshot-m2",
            ]
        }

      + maven {
          + layout_policy  = "STRICT"
          + version_policy = "SNAPSHOT"
        }

      + storage {
          + blob_store_name                = "op2-snapshot-group-m2"
          + strict_content_type_validation = true
          + write_policy                   = "ALLOW"
        }
    }

To Reproduce

  1. modify obv.tf.zip contents to give the group some actual member repos that exist
  2. terraform apply
  3. see that op2-snapshot-group-m2 is of type Release

Expected behavior

op2-snapshot-group-m2 should have version policy of Snapshot

mykelalvis-rialtic avatar Dec 12 '21 12:12 mykelalvis-rialtic

hi @mykelalvis-rialtic,

thanks for your report. Unfortunately the nexus api does not support maven options for creating a maven group.

here is the important excerpt from api version 3.37:

"MavenGroupRepositoryApiRequest": {
      "type": "object",
      "required": [
        "group",
        "name",
        "online",
        "storage"
      ],
      "properties": {
        "name": {
          "type": "string",
          "example": "internal",
          "description": "A unique identifier for this repository",
          "pattern": "^[a-zA-Z0-9\\-]{1}[a-zA-Z0-9_\\-\\.]*$"
        },
        "online": {
          "type": "boolean",
          "example": true,
          "description": "Whether this repository accepts incoming requests"
        },
        "storage": {
          "$ref": "#/definitions/StorageAttributes"
        },
        "group": {
          "$ref": "#/definitions/GroupAttributes"
        }
      }
    },

I am sorry that this cannot be seen. We are in the process of splitting up the repository resource so that everything is easier to use. I will open a request at sonatype for the this feature in the api

regards André

anmoel avatar Dec 12 '21 20:12 anmoel

Issue at nexus jira is created. here: https://issues.sonatype.org/browse/NEXUS-30501

anmoel avatar Dec 12 '21 20:12 anmoel

So...to be clear....the Nexus API forces you to select an option that cannot be changed at a later date. #genius 😄

Also...thanks! I'll try to work that from my end, as well.

mykelalvis-rialtic avatar Dec 12 '21 23:12 mykelalvis-rialtic

And just so everyone understands why, it appears that if I set the version_policy to release, then it only resolves releases. Thus a true snapshot group seems effectively impossible to produce with this provider at the present time.

mykelalvis-rialtic avatar Dec 12 '21 23:12 mykelalvis-rialtic

This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 7 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

github-actions[bot] avatar Oct 25 '22 08:10 github-actions[bot]