func getLocalName(localRef string) (string, string) {
	localExpr := localRefPattern.FindString(localRef)
	match := localRefPattern.FindStringSubmatch(localRef)
	result := make(map[string]string)
	for i, name := range localRefPattern.SubexpNames() {
		if i != 0 && name != "" {
			result[name] = match[i]
		}
	}
	localName := result["name"]
	zap.S().Debugf("extracted local value name %q from reference %q", localName, localRef)
	return localName, localExpr
}
getLocalName returns the actual local value name as configured in IaC. It
trims of "${local." prefix and "}" suffix and returns the local value name
package commons
import (
	"encoding/json"
	"io/ioutil"
	"reflect"
	"regexp"
	"strings"
	"github.com/hashicorp/hcl/v2/hclsyntax"
	"go.uber.org/zap"
)
var (
	localRefPattern = regexp.MustCompile(`(\$\{)?local\.(?P<name>\w*)(\})?`)
)
func isLocalRef(attrVal string) bool {
	return localRefPattern.MatchString(attrVal)
}