func CheckTerraformVersion(constraint string, terragruntOptions *options.TerragruntOptions) error {
	return checkTerraformVersionMeetsConstraint(terragruntOptions.TerraformVersion, constraint)
}
Check that the currently installed Terraform version works meets the specified version constraint and return an error
if it doesn't
package cli
import (
	"fmt"
	"io/ioutil"
	"regexp"
	"strings"
	"github.com/gruntwork-io/terragrunt/errors"
	"github.com/gruntwork-io/terragrunt/options"
	"github.com/gruntwork-io/terragrunt/shell"
	"github.com/hashicorp/go-version"
)
var TerraformVersionRegex = regexp.MustCompile(`Terraform (v?\d+\.\d+\.\d+).*`)
func PopulateTerraformVersion(terragruntOptions *options.TerragruntOptions) error {
	terragruntOptionsCopy := terragruntOptions.Clone(terragruntOptions.TerragruntConfigPath)
	terragruntOptionsCopy.Writer = ioutil.Discard
	terragruntOptionsCopy.ErrWriter = ioutil.Discard
	for key := range terragruntOptionsCopy.Env {
		if strings.HasPrefix(key, "TF_CLI_ARGS") {
			delete(terragruntOptionsCopy.Env, key)
		}
	}
	output, err := shell.RunTerraformCommandWithOutput(terragruntOptionsCopy, "--version")
	if err != nil {
		return err
	}
	terraformVersion, err := parseTerraformVersion(output.Stdout)
	if err != nil {
		return err
	}
	terragruntOptions.TerraformVersion = terraformVersion
	terragruntOptions.Logger.Debugf("Terraform version: %s", terraformVersion)
	return nil
}