code: func (m *Meta) Module(path string) (*module.Tree, tfdiags.Diagnostics) {
  	var diags tfdiags.Diagnostics
  
  	mod, err := module.NewTreeModule("", path)
  	if err != nil {
  		// Check for the error where we have no config files
  		if errwrap.ContainsType(err, new(config.ErrNoConfigsFound)) {
  			return nil, nil
  		}
  
  		diags = diags.Append(err)
  		return nil, diags
  	}
  
  	err = mod.Load(m.moduleStorage(m.DataDir(), module.GetModeNone))
  	if err != nil {
  		diags = diags.Append(errwrap.Wrapf("Error loading modules: {{err}}", err))
  		return nil, diags
  	}
  
  	diags = diags.Append(mod.Validate())
  
  	return mod, diags
  }
docs: // Module loads the module tree for the given root path using the legacy
  // configuration loader.
  //
  // It expects the modules to already be downloaded. This will never
  // download any modules.
  //
  // The configuration is validated before returning, so the returned diagnostics
  // may contain warnings and/or errors. If the diagnostics contains only
  // warnings, the caller may treat the returned module.Tree as valid after
  // presenting the warnings to the user.