Convert legacy provider addresses via Registry API #458
Labels
enhancement
New feature or request
providers
Functionality related to Terraform providers
technical-debt
Current Version
Background
As part of #454 we start to represent provider addresses as special types (as opposed to opaque strings) since that makes it possible to reliably compare and store these addresses. i.e. to tell that for example
registry.terraform.io/hashicorp/aws
==hashicorp/aws
and to be able to tell whether the provider comes from the official registry (in which case we can make assumptions about URLs for docs etc.).Problem Definition
There are two scenarios where we may run into an address that isn't valid.
Migrated providers
Some providers which previously lived under the single global namespace were migrated out to their own namespace.
For example the
terraform-providers/grafana
provider was migrated tografana/grafana
.0.12
Terraform 0.12 users would end up with "legacy" short address format in multiple places
terraform version
outputterraform providers schema -json
required_providers
block with simple entries such asaws = "~> 3.0"
as opposed to whole object declaring thesource
0.13+
Users may not have provider requirements explicitly defined (e.g. they don't have
terraform
block at all, or only specify versions, notsource
). In that case module metadata contains legacy addresses as provider requirements.Attempted Solutions
Attempt to match providers by swapping "legacy" (unknown) namespace for
hashicorp
, or lookup the first provider of the same type name (i.e. the last segment of the address after/
).This isn't accurate, but probably accurate enough for the time being, given that we're looking in just ~100-150 preloaded providers + whatever was sourced via CLI. This certainly won't scale though.
Proposal
Introduce a new module operation which can request details about a provider from the Registry API (and cache it), such as whether it was migrated and where. See https://github.com/hashicorp/terraform-registry-address#what-to-do-with-a-legacy-address for more.
The text was updated successfully, but these errors were encountered: