From 5667df4969277131bfa5bc964b6dae4fd758630c Mon Sep 17 00:00:00 2001 From: Arel Rabinowitz <30493345+RLRabinowitz@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:46:37 +0300 Subject: [PATCH] Change link for missing module or missing provider (#1724) Signed-off-by: RLRabinowitz --- internal/command/e2etest/init_test.go | 5 +++-- internal/command/init.go | 2 +- internal/initwd/module_install.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/command/e2etest/init_test.go b/internal/command/e2etest/init_test.go index fc2c7255c5..b7654c12e4 100644 --- a/internal/command/e2etest/init_test.go +++ b/internal/command/e2etest/init_test.go @@ -432,7 +432,7 @@ func TestInitProviderNotFound(t *testing.T) { } oneLineStdout := strings.ReplaceAll(stdout, "\n", " ") - if !strings.Contains(oneLineStdout, `"diagnostic":{"severity":"error","summary":"Failed to query available provider packages","detail":"Could not retrieve the list of available versions for provider hashicorp/nonexist: provider registry registry.opentofu.org does not have a provider named registry.opentofu.org/hashicorp/nonexist\n\nAll modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending on hashicorp/nonexist, run the following command:\n tofu providers\n\nIf you believe this provider is missing from the registry, please submit a issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/"},"type":"diagnostic"}`) { + if !strings.Contains(oneLineStdout, `"diagnostic":{"severity":"error","summary":"Failed to query available provider packages","detail":"Could not retrieve the list of available versions for provider hashicorp/nonexist: provider registry registry.opentofu.org does not have a provider named registry.opentofu.org/hashicorp/nonexist\n\nAll modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending on hashicorp/nonexist, run the following command:\n tofu providers\n\nIf you believe this provider is missing from the registry, please submit a issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/new/choose"},"type":"diagnostic"}`) { t.Errorf("expected error message is missing from output:\n%s", stdout) } }) @@ -493,7 +493,8 @@ func TestInitProviderNotFound(t *testing.T) { │ tofu providers │ │ If you believe this provider is missing from the registry, please submit a -│ issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/ +│ issue on the OpenTofu Registry +│ https://github.com/opentofu/registry/issues/new/choose ╵ ` diff --git a/internal/command/init.go b/internal/command/init.go index 7756af0c8f..3127235610 100644 --- a/internal/command/init.go +++ b/internal/command/init.go @@ -703,7 +703,7 @@ func (c *InitCommand) getProviders(ctx context.Context, config *configs.Config, } if provider.Hostname == addrs.DefaultProviderRegistryHost { - suggestion += "\n\nIf you believe this provider is missing from the registry, please submit a issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/" + suggestion += "\n\nIf you believe this provider is missing from the registry, please submit a issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/new/choose" } diags = diags.Append(tfdiags.Sourceless( diff --git a/internal/initwd/module_install.go b/internal/initwd/module_install.go index f2316e7c7d..b291e711f0 100644 --- a/internal/initwd/module_install.go +++ b/internal/initwd/module_install.go @@ -440,7 +440,7 @@ func (i *ModuleInstaller) installRegistryModule(ctx context.Context, req *config if registry.IsModuleNotFound(err) { suggestion := "" if hostname == addrs.DefaultModuleRegistryHost { - suggestion = "\n\nIf you believe this module is missing from the registry, please submit a issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/" + suggestion = "\n\nIf you believe this module is missing from the registry, please submit a issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/new/choose" } diags = diags.Append(&hcl.Diagnostic{