func toYaml(v interface{}) string {
	data, err := yaml.Marshal(v)
	if err != nil {
		if Strict {
			panic(err.Error())
		}
		return ""
	}
	return string(data)
}
toYaml takes an interface, marshals it to yaml, and returns a string.
On marshal error will panic if in strict mode, otherwise returns empty string.

This is designed to be called from a template.
package main
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"strconv"
	"strings"
	"text/template"
	"time"
	"github.com/BurntSushi/toml"
	"github.com/Masterminds/sprig"
	"github.com/go-yaml/yaml"
	"github.com/ismferd/ssm/package/parameterstore"
	"github.com/overdrive3000/secretsmanager"
)
func FuncMap(templateName string) template.FuncMap {
	f := sprig.TxtFuncMap()
	f["toJson"] = toJson
	f["toYaml"] = toYaml
	f["toToml"] = toToml
	f["toBool"] = toBool
	f["fileExists"] = fileExists
	f["fileSize"] = fileSize
	f["fileLastModified"] = fileLastModified
	f["fileGetBytes"] = fileGetBytes
	f["fileGetString"] = fileGetString
	f["include"] = include(templateName)
	f["countRune"] = func(s string) int {
		return len([]rune(s))
	}
	oRegexReplaceAll := f["regexReplaceAll"].(func(regex string, s string, repl string) string)
	oRegexReplaceAllLiteral := f["regexReplaceAllLiteral"].(func(regex string, s string, repl string) string)
	oRegexSplit := f["regexSplit"].(func(regex string, s string, n int) []string)
	f["reReplaceAll"] = func(regex string, replacement string, input string) string {
		return oRegexReplaceAll(regex, input, replacement)
	}
	f["reReplaceAllLiteral"] = func(regex string, replacement string, input string) string {
		return oRegexReplaceAllLiteral(regex, input, replacement)
	}
	f["reSplit"] = func(regex string, n int, input string) []string {
		return oRegexSplit(regex, input, n)
	}
	f["awsSecret"] = getAWSSecret
	f["awsParameterStore"] = getAWSParameterStore
	return f
}
func getAWSSecret(secret ...string) string {
	var name, key string
	c := secretsmanager.New(
		&secretsmanager.AWSConfig{},
	)
	name = secret[0]
	if len(secret) == 2 {
		key = secret[1]
	}
	spec := &secretsmanager.SecretSpec{
		Name: name,
		Key:  key,
	}
	s, err := c.GetSecret(spec)
	if err != nil {
		if Strict {
			panic(err)
		}
		return ""
	}
	return s
}
func getAWSParameterStore(parameter string) string {
	c := parameterstore.New(
		&parameterstore.AWSConfig{},
	)
	spec := &parameterstore.ParemeterString{
		Name: parameter,
	}
	p, err := c.GetParam(spec)
	if err != nil {
		if Strict {
			panic(err)
		}
		return ""
	}
	return p
}
func toBool(value string) bool {
	result, err := strconv.ParseBool(value)
	if err != nil {
		if Strict {
			panic(err.Error())
		}
		return false
	}
	return result
}
func toJson(v interface{}) string {
	data, err := json.Marshal(v)
	if err != nil {
		if Strict {
			panic(err.Error())
		}
		return ""
	}
	return string(data)
}