func runHCLFmt(terragruntOptions *options.TerragruntOptions) error {
	workingDir := terragruntOptions.WorkingDir
	targetFile := terragruntOptions.HclFile
	if targetFile != "" {
		if !filepath.IsAbs(targetFile) {
			targetFile = util.JoinPath(workingDir, targetFile)
		}
		terragruntOptions.Logger.Debugf("Formatting hcl file at: %s.", targetFile)
		return formatTgHCL(terragruntOptions, targetFile)
	}
	terragruntOptions.Logger.Debugf("Formatting hcl files from the directory tree %s.", terragruntOptions.WorkingDir)
	tgHclFiles, err := zglob.Glob(util.JoinPath(workingDir, "**", "*.hcl"))
	if err != nil {
		return err
	}
	filteredTgHclFiles := []string{}
	for _, fname := range tgHclFiles {
		if !util.ListContainsElement(strings.Split(fname, "/"), ".terragrunt-cache") {
			filteredTgHclFiles = append(filteredTgHclFiles, fname)
		} else {
			terragruntOptions.Logger.Debugf("%s was ignored due to being in the terragrunt cache", fname)
		}
	}
	terragruntOptions.Logger.Debugf("Found %d hcl files", len(filteredTgHclFiles))
	var formatErrors *multierror.Error
	for _, tgHclFile := range filteredTgHclFiles {
		err := formatTgHCL(terragruntOptions, tgHclFile)
		if err != nil {
			formatErrors = multierror.Append(formatErrors, err)
		}
	}
	return formatErrors.ErrorOrNil()
}
runHCLFmt recursively looks for hcl files in the directory tree starting at workingDir, and formats them
based on the language style guides provided by Hashicorp. This is done using the official hcl2 library.
package cli
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/hashicorp/go-multierror"
	"github.com/hashicorp/hcl/v2/hclparse"
	"github.com/hashicorp/hcl/v2/hclwrite"
	"github.com/mattn/go-zglob"
	"github.com/gruntwork-io/terragrunt/options"
	"github.com/gruntwork-io/terragrunt/util"
)