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

Repository doesn't notice changes to routing rules #397

Closed adam-carruthers closed 5 months ago

adam-carruthers commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.6.1

Nexus Provider Version

1.22.0

Nexus Version

3.59.0-01

Affected Resource(s)/Data Source(s)

nexus_repository_r_proxy

Terraform Configuration Files

resource "nexus_repository_r_proxy" "cran_mirror" {
  name         = "cran-mirror"
  online       = true
  routing_rule = "allow_cran"  # after deploying this, change it manually on the Nexus server, the provider won't notice.

  storage {
    blob_store_name                = "default_s3"
    strict_content_type_validation = true
  }

  proxy {
    remote_url = "http://example.com"

    content_max_age  = 5
    metadata_max_age = 5
  }

  negative_cache {
    enabled = false
  }

  http_client {
    blocked    = false
    auto_block = true
  }
}

Debug Output/Panic Output

No debug logs.

If you change the routing rule manually on nexus after deploying the repo, the provider doesn't notice that the routing rule hasn't changed.

Expected Behaviour

It should have noticed the routing rule was changed manually, and added to the plan to change it back.

Actual Behaviour

The plan showed no changes.

Steps to Reproduce

  1. terraform apply to create the repo
  2. manually login to Nexus and change the routing rules for the repository to None
  3. terraform plan

References

No response

Edu-DevOps commented 8 months ago

I have been able to reproduce this using following versions:

I could reproduce the issue with a maven proxy repo also so all proxy repos are potentially affected

Edu-DevOps commented 8 months ago

Investigating a bit deeper, this issue only happens when the routing rule is manually unassigned to the repo. In the case that another routing rule has been assigned, terraform detect the change and wants to align the repo:

Terraform will perform the following actions:

  # nexus_repository_r_proxy.cran_mirror will be updated in-place
  ~ resource "nexus_repository_r_proxy" "cran_mirror" {
        id           = "cran-mirror"
        name         = "cran-mirror"
      ~ routing_rule = "another_routing" -> "allow_cran"
        # (1 unchanged attribute hidden)

        # (4 unchanged blocks hidden)
    }
anmoel commented 5 months ago

@Edu-DevOps fix was released with version 2.3.0