mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
904 missing provider module message (#981)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
parent
1f9f0bd2af
commit
47071c2696
@ -380,6 +380,9 @@ func TestInitProviderNotFound(t *testing.T) {
|
||||
│ modules are currently depending on hashicorp/nonexist, run the following
|
||||
│ command:
|
||||
│ 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/
|
||||
╵
|
||||
|
||||
`
|
||||
|
@ -658,6 +658,10 @@ 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/"
|
||||
}
|
||||
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Failed to query available provider packages",
|
||||
|
@ -436,10 +436,15 @@ func (i *ModuleInstaller) installRegistryModule(ctx context.Context, req *config
|
||||
resp, err = reg.ModuleVersions(ctx, regsrcAddr)
|
||||
if err != nil {
|
||||
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/"
|
||||
}
|
||||
|
||||
diags = diags.Append(&hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: "Module not found",
|
||||
Detail: fmt.Sprintf("Module %q (from %s:%d) cannot be found in the module registry at %s.", req.Name, req.CallRange.Filename, req.CallRange.Start.Line, hostname),
|
||||
Detail: fmt.Sprintf("Module %s (%q from %s:%d) cannot be found in the module registry at %s.%s", addr.Package.ForRegistryProtocol(), req.Name, req.CallRange.Filename, req.CallRange.Start.Line, hostname, suggestion),
|
||||
Subject: req.CallRange.Ptr(),
|
||||
})
|
||||
} else if errors.Is(err, context.Canceled) {
|
||||
|
Loading…
Reference in New Issue
Block a user