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

Consider Aliases in the Registry #89

Open
cam72cam opened this issue Dec 6, 2023 · 0 comments
Open

Consider Aliases in the Registry #89

cam72cam opened this issue Dec 6, 2023 · 0 comments

Comments

@cam72cam
Copy link
Member

cam72cam commented Dec 6, 2023

This is a more nuanced view of #87. https://developer.hashicorp.com/terraform/internals/archiving is also worth reading.

Related tofu code can be found here:
https://github.com/opentofu/opentofu/blob/5c1ecde90a1770cc2722aa9e21769422e6dd8491/internal/getproviders/didyoumean.go#L234
https://github.com/opentofu/opentofu/blob/5c1ecde90a1770cc2722aa9e21769422e6dd8491/internal/command/command_test.go#L1055
https://github.com/opentofu/opentofu/blob/5c1ecde90a1770cc2722aa9e21769422e6dd8491/internal/getproviders/registry_client_test.go#L241

Provider examples to consider:

source = "github"

This is mapped to hashicorp/github or opentofu/github by tofu, whichever is the default namespace.

Those paths imply the repository: https://github.com/hashicorp/terraform-provider-github. This repository is archived and a fork of the https://github.com/integrations/terraform-provider-github repository. This implies a redirect which can be confirmed using a recent version of terraform.

We now have an "Override" implemented in #87 that makes sure integrations/github is copied to hashicorp/github. This seems to match terraform's behavior.

source = "digitalocean"

This is mapped to hashicorp/digitalocean or opentofu/digitalocean by tofu, whichever is the default namespace.

Those paths imply the repository: https://github.com/hashicorp/terraform-provider-digitalocean. This repository is archived and a fork of the https://github.com/digitalocean/terraform-provider-digitalocean repository. This implies a redirect which is not confirmed using a recent version of terraform.

We now have an "Override" implemented in #87 that makes sure digitalocean/digitalocean is copied to hashicorp/digitalocean. This does not seems to match terraform's behavior. Instead running terraform suggests the digitalocean/digitalocean package as part of an error response.

This is part of the 0.13upgrade path that has been left in the 1.5.x code that was forked into opentofu. If a provider in the default namespace is not found, either hashicorp/digitalocean or digitalocean, a request is sent to the currently configured registry for "/v1/providers/-/digitalocean/versions". It then looks for a moved_to field in the response and uses that to build the error message.

Summary:

I do not understand why one of these is a redirect and one is an "alias". This temporary override in #87 opens up the question of how to properly support "moved_to" in tofu as a whole. There are limitations as it is unclear if we can duplicate the exact "moved_to" configurations. At the moment it is a best guess based on repository names / status as documented in #87.

Additionally, in #87 I did not synchronize the overrides to the opentofu namespace, which should be done soon.

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

No branches or pull requests

1 participant