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

harbor_replications filter not working at all. #422

Open
haiwu opened this issue Mar 27, 2024 · 3 comments
Open

harbor_replications filter not working at all. #422

haiwu opened this issue Mar 27, 2024 · 3 comments
Labels
question Further information is requested

Comments

@haiwu
Copy link

haiwu commented Mar 27, 2024

Describe the bug
harbor_replications filter not working at all.

To Reproduce
Just try to use the example section listed in the document section (https://github.com/goharbor/terraform-provider-harbor/blob/main/docs/resources/replication.md), and you will see it does not work at all. There's no where to see the 'qa' label. Only the name and tag could show up. Also there's no way to specify 'includes' or 'excludes'. In the code, it has 'decoration' field, already tried and that does not work at all.

Note: I have tried every single possible harbor-terraform-provider available from this repo, including the latest one, and none works. There are some old providers I could not grab, since those are not with this new repo after the ownership changed.

resource "harbor_replication" "alpine" {
  name        = "alpine"
  action      = "pull"
  registry_id = harbor_registry.main.registry_id
  schedule = "0 0/15 * * * *"
  filters {
    name = "library/alpine"
  }
  filters {
    tag = "3.*.*"
  }
  filters {
    resource = "artifact"
  }
  filters {
    labels = ["qa"]
  }
}

Expected behavior
The filter examples listed in the documentation url should all work ok, but that's not the case at all:
https://github.com/goharbor/terraform-provider-harbor/blob/main/docs/resources/replication.md

Additional context

  • Provider Version: all versions found in the repo after ownership changed.
  • Terraform Version: 1.5.1, or latest one, or latest opentofu version, none worked.
  • Harbor Version: latest 2.10.0
@flbla
Copy link
Contributor

flbla commented Apr 8, 2024

Hi @haiwu ,
with pull-based mode, label filter is only available if source is a Harbor instance

if you want to try, you can try to replicate your harbor to itself:

resource "harbor_registry" "main" {
  provider_name = "harbor"
  name          = "local"
  endpoint_url  = "http://my-release-harbor-core"
  description = "local"
  access_id = "USER"
  access_secret = "PASS"
}

resource "harbor_replication" "alpine" {
  name        = "alpine"
  action      = "pull"
  registry_id = harbor_registry.main.registry_id
  schedule    = "manual"
  filters {
    name = "library/alpine"
  }
  filters {
    labels = [ "qa" ]
  }
  filters {
    resource = "artifact"
  }
  filters {
    tag = "3.*.*"
  }
}

image

@flbla flbla added the question Further information is requested label Apr 8, 2024
@haiwu
Copy link
Author

haiwu commented Apr 8, 2024

@flbla : My tests were with harbor instances (both src and target are harbor instances), and it was not working for me.

Which harbor versions, harbor terraform provider version, terraform version you used ok with this one?

@flbla
Copy link
Contributor

flbla commented Apr 12, 2024

hi,
harbor : v2.10.1, terraform 1.8.0 and latest provider version
i'm not sure it will help but can you copy the output of the plan ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants