code: func LoadConfig() (*Config, tfdiags.Diagnostics) {
  	var diags tfdiags.Diagnostics
  	configVal := BuiltinConfig // copy
  	config := &configVal
  
  	if mainFilename, err := cliConfigFile(); err == nil {
  		if _, err := os.Stat(mainFilename); err == nil {
  			mainConfig, mainDiags := loadConfigFile(mainFilename)
  			diags = diags.Append(mainDiags)
  			config = config.Merge(mainConfig)
  		}
  	}
  
  	if configDir, err := ConfigDir(); err == nil {
  		if info, err := os.Stat(configDir); err == nil && info.IsDir() {
  			dirConfig, dirDiags := loadConfigDir(configDir)
  			diags = diags.Append(dirDiags)
  			config = config.Merge(dirConfig)
  		}
  	}
  
  	if envConfig := EnvConfig(); envConfig != nil {
  		// envConfig takes precedence
  		config = envConfig.Merge(config)
  	}
  
  	diags = diags.Append(config.Validate())
  
  	return config, diags
  }
docs: // LoadConfig reads the CLI configuration from the various filesystem locations
  // and from the environment, returning a merged configuration along with any
  // diagnostics (errors and warnings) encountered along the way.