func convertPrimitiveType(ctyVal cty.Value) (interface{}, error) {
	for _, converter := range ctyNativeConverterFuncs {
		if val, err := converter(ctyVal); err == nil {
			return val, err
		}
	}
	return nil, fmt.Errorf("ctyVal could not be resolved to native go type")
}
convertPrimitiveType converts a primitive cty.Value to its go native type
package commons
import (
	"fmt"
	"github.com/pkg/errors"
	"github.com/zclconf/go-cty/cty"
	"github.com/zclconf/go-cty/cty/gocty"
)
var (
	ctyNativeConverterFuncs = []func(cty.Value) (interface{}, error){ctyToStr, ctyToInt, ctyToFloat, ctyToBool}
)
func ctyToStr(ctyVal cty.Value) (interface{}, error) {
	var val string
	err := gocty.FromCtyValue(ctyVal, &val)
	return val, err
}
func ctyToInt(ctyVal cty.Value) (interface{}, error) {
	var val int
	err := gocty.FromCtyValue(ctyVal, &val)
	return val, err
}
func ctyToFloat(ctyVal cty.Value) (interface{}, error) {
	var val float64
	err := gocty.FromCtyValue(ctyVal, &val)
	return val, err
}
func ctyToBool(ctyVal cty.Value) (interface{}, error) {
	var val bool
	err := gocty.FromCtyValue(ctyVal, &val)
	return val, err
}
func ctyToSlice(ctyVal cty.Value) (interface{}, error) {
	var val []interface{}
	var allErrs error
	if ctyVal.Type().IsListType() || ctyVal.Type().IsTupleType() || ctyVal.Type().IsSetType() {
		for _, v := range ctyVal.AsValueSlice() {
			nativeVal, err := convertCtyToGoNative(v)
			if err != nil {
				allErrs = errors.Wrap(allErrs, err.Error())
				continue
			}
			val = append(val, nativeVal)
		}
		if allErrs != nil {
			return nil, allErrs
		}
		return val, nil
	}
	return val, fmt.Errorf("incorrect type")
}
func ctyToMap(ctyVal cty.Value) (interface{}, error) {
	if !(ctyVal.Type().IsMapType() || ctyVal.Type().IsObjectType()) {
		return nil, fmt.Errorf("not map type")
	}
	var (
		ctyValMap = ctyVal.AsValueMap()  
		val       = make(map[string]interface{})
		allErrs   error
	)
	if len(ctyValMap) < 1 {
		return nil, fmt.Errorf("empty ctyValMap")
	}
	for k, v := range ctyValMap {
		nativeVal, err := convertCtyToGoNative(v)
		if err != nil {
			allErrs = errors.Wrap(allErrs, err.Error())
			continue
		}
		val[k] = nativeVal
	}
	if allErrs != nil {
		return nil, allErrs
	}
	return val, nil
}
func convertCtyToGoNative(ctyVal cty.Value) (interface{}, error) {
	if ctyVal.IsNull() {
		return nil, nil
	}
	if ctyVal.Type().IsPrimitiveType() {
		return convertPrimitiveType(ctyVal)
	}
	return convertComplexType(ctyVal)
}