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

Convert legacy provider addresses via Registry API #458

Open
radeksimko opened this issue Apr 15, 2021 · 0 comments
Open

Convert legacy provider addresses via Registry API #458

radeksimko opened this issue Apr 15, 2021 · 0 comments
Labels
enhancement New feature or request providers Functionality related to Terraform providers technical-debt

Comments

@radeksimko
Copy link
Member

radeksimko commented Apr 15, 2021

Current Version

0.15.0

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 to grafana/grafana.

0.12

Terraform 0.12 users would end up with "legacy" short address format in multiple places

  • terraform version output
  • terraform providers schema -json
  • required_providers block with simple entries such as aws = "~> 3.0" as opposed to whole object declaring the source

0.13+

Users may not have provider requirements explicitly defined (e.g. they don't have terraform block at all, or only specify versions, not source). 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request providers Functionality related to Terraform providers technical-debt
Projects
None yet
Development

No branches or pull requests

2 participants