code: func loadConfigFile(path string) (*Config, tfdiags.Diagnostics) {
  	var diags tfdiags.Diagnostics
  	result := &Config{}
  
  	log.Printf("Loading CLI configuration from %s", path)
  
  	// Read the HCL file and prepare for parsing
  	d, err := ioutil.ReadFile(path)
  	if err != nil {
  		diags = diags.Append(fmt.Errorf("Error reading %s: %s", path, err))
  		return result, diags
  	}
  
  	// Parse it
  	obj, err := hcl.Parse(string(d))
  	if err != nil {
  		diags = diags.Append(fmt.Errorf("Error parsing %s: %s", path, err))
  		return result, diags
  	}
  
  	// Build up the result
  	if err := hcl.DecodeObject(&result, obj); err != nil {
  		diags = diags.Append(fmt.Errorf("Error parsing %s: %s", path, err))
  		return result, diags
  	}
  
  	// Replace all env vars
  	for k, v := range result.Providers {
  		result.Providers[k] = os.ExpandEnv(v)
  	}
  	for k, v := range result.Provisioners {
  		result.Provisioners[k] = os.ExpandEnv(v)
  	}
  
  	if result.PluginCacheDir != "" {
  		result.PluginCacheDir = os.ExpandEnv(result.PluginCacheDir)
  	}
  
  	return result, diags
  }
docs: // loadConfigFile loads the CLI configuration from ".terraformrc" files.