datadrivers / terraform-provider-nexus

Terraform provider for Sonatype Nexus
https://registry.terraform.io/providers/datadrivers/nexus
Mozilla Public License 2.0
119 stars 53 forks source link

Not possible to set maven configuration on a nexus_repository_maven_group #389

Open thcuvelier opened 1 year ago

thcuvelier commented 1 year ago

Is there an existing issue for this?

Community Note

Inpossible to setup on the maven group level the maven block maven { version_policy = "MIXED" layout_policy = "STRICT" content_disposition = "INLINE" }

where in nexus administration console it's possible.

image

Terraform Version

1.5.7

Nexus Provider Version

1.22.0

Nexus Version

3.49.0

Affected Resource(s)/Data Source(s)

nexus_repository_maven_group

Terraform Configuration Files

resource "nexus_repository_maven_group" "maven-public" {
  name   = "maven-public"
  online = true

  group {
    member_names     = [,nexus_repository_maven_hosted.maven-snapshots.name,nexus_repository_maven_proxy.maven-releases.name]
  }

  maven {
    version_policy   = "MIXED"
    layout_policy    = "STRICT"
    content_disposition = "INLINE"
  }

  storage {
    blob_store_name                = "default"
    strict_content_type_validation = true
  }

}

resource "nexus_repository_maven_hosted" "maven-releases" {
  name   = "maven-releases"
  online = true

  component {
    proprietary_components = false
  }

  storage {
    blob_store_name                = "default"
    strict_content_type_validation = true
    write_policy = "ALLOW_ONCE"
  }

  maven {
    version_policy   = "RELEASE"
    layout_policy    = "STRICT"
    content_disposition = "INLINE"
  }

}

resource "nexus_repository_maven_hosted" "maven-snapshots" {
  name   = "maven-snapshots"
  online = true

  component {
    proprietary_components = false
  }

  storage {
    blob_store_name                = "default"
    strict_content_type_validation = true
    write_policy = "ALLOW"
  }

  maven {
    version_policy   = "SNAPSHOT"
    layout_policy    = "STRICT"
    content_disposition = "INLINE"
  }

}

Debug Output/Panic Output

terraform apply
╷
│ Error: Unsupported block type
│
│   on __nexus-repos.tf line 38, in resource "nexus_repository_maven_group" "maven-public":
│   38:   maven {
│
│ Blocks of type "maven" are not expected here.

Expected Behaviour

Possibility to configure the maven block on the group level

Actual Behaviour

Not possible to configure the maven block on the group level

Steps to Reproduce

No response

References

No response

anmoel commented 1 year ago

hi @thcuvelier,

it looks like it will be the same problem as issue #148. Can you confirm that?

kind regards André

anmoel commented 1 year ago

it's looks like we can now set the configuration but cannot read the maven block from the nexus api

thcuvelier commented 1 year ago

I confirm that this is the same problem as issue #148.

anmoel commented 1 year ago

Hi @thcuvelier, we will implement the maven block into the resource nexus_repository_maven_group. But there are some problems. the Nexus API don't return the values for the maven block in a GET call. so we only can change the maven configuration at creation or update of the resource. the resource can not detect changes in the group repository.

After implementing, we will open a new issue for that and will inform the developer of sonatype.

thcuvelier commented 1 year ago

Thx waiting the new release