code: func NewModule(primaryFiles, overrideFiles []*File) (*Module, hcl.Diagnostics) {
  	var diags hcl.Diagnostics
  	mod := &Module{
  		ProviderConfigs:      map[string]*Provider{},
  		ProviderRequirements: map[string][]VersionConstraint{},
  		Variables:            map[string]*Variable{},
  		Locals:               map[string]*Local{},
  		Outputs:              map[string]*Output{},
  		ModuleCalls:          map[string]*ModuleCall{},
  		ManagedResources:     map[string]*Resource{},
  		DataResources:        map[string]*Resource{},
  	}
  
  	for _, file := range primaryFiles {
  		fileDiags := mod.appendFile(file)
  		diags = append(diags, fileDiags...)
  	}
  
  	for _, file := range overrideFiles {
  		fileDiags := mod.mergeFile(file)
  		diags = append(diags, fileDiags...)
  	}
  
  	return mod, diags
  }
docs: // NewModule takes a list of primary files and a list of override files and
  // produces a *Module by combining the files together.
  //
  // If there are any conflicting declarations in the given files -- for example,
  // if the same variable name is defined twice -- then the resulting module
  // will be incomplete and error diagnostics will be returned. Careful static
  // analysis of the returned Module is still possible in this case, but the
  // module will probably not be semantically valid.