code: func (c *Config) ProviderDependencies() (*moduledeps.Module, tfdiags.Diagnostics) {
  	var diags tfdiags.Diagnostics
  
  	var name string
  	if len(c.Path) > 0 {
  		name = c.Path[len(c.Path)-1]
  	}
  
  	ret := &moduledeps.Module{
  		Name: name,
  	}
  
  	providers := make(moduledeps.Providers)
  	for name, reqs := range c.Module.RequiredProviders {
  		inst := moduledeps.ProviderInstance(name)
  		var constraints version.Constraints
  		for _, reqStr := range reqs {
  			if reqStr != "" {
  				constraint, err := version.NewConstraint(reqStr)
  				if err != nil {
  					diags = diags.Append(wrapDiagnostic(tfconfig.Diagnostic{
  						Severity: tfconfig.DiagError,
  						Summary:  "Invalid provider version constraint",
  						Detail:   fmt.Sprintf("Invalid version constraint %q for provider %s.", reqStr, name),
  					}))
  					continue
  				}
  				constraints = append(constraints, constraint...)
  			}
  		}
  		providers[inst] = moduledeps.ProviderDependency{
  			Constraints: discovery.NewConstraints(constraints),
  			Reason:      moduledeps.ProviderDependencyExplicit,
  		}
  	}
  	ret.Providers = providers
  
  	childNames := make([]string, 0, len(c.Children))
  	for name := range c.Children {
  		childNames = append(childNames, name)
  	}
  	sort.Strings(childNames)
  
  	for _, name := range childNames {
  		child, childDiags := c.Children[name].ProviderDependencies()
  		ret.Children = append(ret.Children, child)
  		diags = diags.Append(childDiags)
  	}
  
  	return ret, diags
  }
docs: // ProviderDependencies returns the provider dependencies for the recieving
  // config, including all of its descendent modules.