hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.34k stars 9.49k forks source link

A way for the registry redirect the url corresponding to a fully qualified provider name #35746

Open KloudGeek opened 1 day ago

KloudGeek commented 1 day ago

Terraform Version

Terraform v1.9.5
on windows_amd64
+ provider registry.terraform.io/hashicorp/azuread v2.53.1
+ provider registry.terraform.io/hashicorp/azurerm v4.2.0

Terraform Configuration Files

Note: no particular configuration example other than the fact that the provider block accidentally omitted.

Debug Output

No debug output available.

Expected Behavior

The URL shown in 'Actual Behavior' should be: "registry.terraform.io/providers/hashicorp/azurerm" and not "registry.terraform.io/hashicorp/azurerm"

Actual Behavior

Planning failed. Terraform encountered an error while generating this plan.

╷ │ Error: Invalid provider configuration │ │ Provider "registry.terraform.io/hashicorp/azurerm" requires explicit configuration. Add a provider block to the root module and configure the provider's required arguments as described │ in the provider documentation.

Steps to Reproduce

  1. terraform init
  2. terraform plan

Additional Context

During testing, we accidentally omitted a versions.tf file which contained our provider info for azurerm. The error we received is indeed a valid error, but the URL it provided is inaccurate as noted in Expected Behavior.

References

No response

jbardin commented 7 hours ago

Hi @KloudGeek,

Thanks for filing the issue. The format of the provider isn't intended to be a URL, rather it's the fully qualified name of the provider in the format host/namespace/name. The given string is the unambiguous value you could put in the required_providers source field to locate the provider, though it's typically used in the shortened version hashicorp/azurerm with an implied registry host of registry.terraform.io.

Perhaps however there is something the registry team could do to help redirect this request to a more useful page, so I'll let this issue get forwarded to them.

Thanks!

KloudGeek commented 6 hours ago

Sorry for my misunderstanding, and thank you for the clarification.