code: func (m *Meta) installModules(rootDir string, upgrade bool, hooks initwd.ModuleInstallHooks) tfdiags.Diagnostics {
  	var diags tfdiags.Diagnostics
  	rootDir = m.normalizePath(rootDir)
  
  	err := os.MkdirAll(m.modulesDir(), os.ModePerm)
  	if err != nil {
  		diags = diags.Append(fmt.Errorf("failed to create local modules directory: %s", err))
  		return diags
  	}
  
  	inst := m.moduleInstaller()
  	_, moreDiags := inst.InstallModules(rootDir, upgrade, hooks)
  	diags = diags.Append(moreDiags)
  	return diags
  }
docs: // installModules reads a root module from the given directory and attempts
  // recursively install all of its descendent modules.
  //
  // The given hooks object will be notified of installation progress, which
  // can then be relayed to the end-user. The moduleUiInstallHooks type in
  // this package has a reasonable implementation for displaying notifications
  // via a provided cli.Ui.