davejab / nexus-repository-terraform

A Nexus Repository 3 plugin that allows usage of Terraform repositories.
Eclipse Public License 1.0
16 stars 6 forks source link

proxy for binaries hosted in github #24

Open eossf opened 1 year ago

eossf commented 1 year ago

Hello,

I installed in my Nexus3 your plugin, I proxied the official registry https://registry.terraform.io/ It works fine for all providers where source = "hashicorp/*"

For other providers, for instance source = "illumio/illumio-core", it does not work. my .terraformrc: provider_installation { network_mirror { url = "https://registry.mysite.com/repository/terraform-proxy/v1/providers/" } }

terraform init gives: │ Error while installing illumio/illumio-core v1.1.2: unsuccessful request to │ https://registry.mysite.com/repository/terraform-proxy/v1/providers/registry.terraform.io/illumio/illumio-core/terraform-provider-illumio-core_1.1.2_linux_amd64.zip: 404 Not Found

The binaries are in fact located in github here https://github.com/illumio/terraform-provider-illumio-core/releases This is the basic behaviour of terraform, binaries could be elsewhere than terraform.io. Note: the binaries for "hashicorp/*" are not located in github, example: https://github.com/hashicorp/terraform-provider-azurerm/releases/tag/v3.59.0

How to deal with this situation ? Thanks

davejab commented 1 year ago

@eossf the plugin is capable of pulling binaries from external locations, output below of a test i ran:

Initializing provider plugins...
- Finding illumio/illumio-core versions matching "1.1.2"...
2023-06-08T22:40:00.266+0100 [DEBUG] Querying available versions of provider registry.terraform.io/illumio/illumio-core at network mirror https://localhost:8443/repository/terraform/v1/providers/
2023-06-08T22:40:00.266+0100 [DEBUG] GET https://localhost:8443/repository/terraform/v1/providers/registry.terraform.io/illumio/illumio-core/index.json
2023-06-08T22:40:00.266+0100 [TRACE] HTTP client GET request to https://localhost:8443/repository/terraform/v1/providers/registry.terraform.io/illumio/illumio-core/index.json
2023-06-08T22:40:00.500+0100 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers
2023-06-08T22:40:00.501+0100 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/terraform v1.0.2 for linux_amd64 at .terraform/providers/registry.terraform.io/hashicorp/terraform/1.0.2/linux_amd64
2023-06-08T22:40:00.501+0100 [TRACE] providercache.fillMetaCache: including .terraform/providers/registry.terraform.io/hashicorp/terraform/1.0.2/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/terraform 1.0.2
2023-06-08T22:40:00.501+0100 [DEBUG] Finding package URL for registry.terraform.io/illumio/illumio-core v1.1.2 on linux_amd64 via network mirror https://localhost:8443/repository/terraform/v1/providers/
2023-06-08T22:40:00.501+0100 [DEBUG] GET https://localhost:8443/repository/terraform/v1/providers/registry.terraform.io/illumio/illumio-core/1.1.2.json
2023-06-08T22:40:00.501+0100 [TRACE] HTTP client GET request to https://localhost:8443/repository/terraform/v1/providers/registry.terraform.io/illumio/illumio-core/1.1.2.json
- Installing illumio/illumio-core v1.1.2...
2023-06-08T22:40:01.190+0100 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/illumio/illumio-core v1.1.2 from https://localhost:8443/repository/terraform/v1/providers/registry.terraform.io/illumio/illumio-core/terraform-provider-illumio-core_1.1.2_linux_amd64.zip
2023-06-08T22:40:01.190+0100 [TRACE] HTTP client GET request to https://localhost:8443/repository/terraform/v1/providers/registry.terraform.io/illumio/illumio-core/terraform-provider-illumio-core_1.1.2_linux_amd64.zip
2023-06-08T22:40:02.449+0100 [TRACE] providercache.fillMetaCache: scanning directory .terraform/providers
2023-06-08T22:40:02.449+0100 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/hashicorp/terraform v1.0.2 for linux_amd64 at .terraform/providers/registry.terraform.io/hashicorp/terraform/1.0.2/linux_amd64
2023-06-08T22:40:02.449+0100 [TRACE] getproviders.SearchLocalDirectory: found registry.terraform.io/illumio/illumio-core v1.1.2 for linux_amd64 at .terraform/providers/registry.terraform.io/illumio/illumio-core/1.1.2/linux_amd64
2023-06-08T22:40:02.449+0100 [TRACE] providercache.fillMetaCache: including .terraform/providers/registry.terraform.io/hashicorp/terraform/1.0.2/linux_amd64 as a candidate package for registry.terraform.io/hashicorp/terraform 1.0.2
2023-06-08T22:40:02.449+0100 [TRACE] providercache.fillMetaCache: including .terraform/providers/registry.terraform.io/illumio/illumio-core/1.1.2/linux_amd64 as a candidate package for registry.terraform.io/illumio/illumio-core 1.1.2
- Installed illumio/illumio-core v1.1.2 (unauthenticated)

Are you behind a proxy? Can you access Github from the Nexus server? Are you able to provide nexus logs?

eossf commented 1 year ago

hello I have check log, and it seems to be an URL blocked proxy , should not happen but