|
|
|
|
@ -21,6 +21,7 @@ import (
|
|
|
|
|
"github.com/hashicorp/hil"
|
|
|
|
|
"github.com/hashicorp/hil/ast"
|
|
|
|
|
"github.com/mitchellh/go-homedir"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// stringSliceToVariableValue converts a string slice into the value
|
|
|
|
|
@ -85,6 +86,7 @@ func Funcs() map[string]ast.Function {
|
|
|
|
|
"signum": interpolationFuncSignum(),
|
|
|
|
|
"sort": interpolationFuncSort(),
|
|
|
|
|
"split": interpolationFuncSplit(),
|
|
|
|
|
"timestamp": interpolationFuncTimestamp(),
|
|
|
|
|
"title": interpolationFuncTitle(),
|
|
|
|
|
"trimspace": interpolationFuncTrimSpace(),
|
|
|
|
|
"upper": interpolationFuncUpper(),
|
|
|
|
|
@ -1109,6 +1111,17 @@ func interpolationFuncUUID() ast.Function {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// interpolationFuncTimestamp
|
|
|
|
|
func interpolationFuncTimestamp() ast.Function {
|
|
|
|
|
return ast.Function{
|
|
|
|
|
ArgTypes: []ast.Type{},
|
|
|
|
|
ReturnType: ast.TypeString,
|
|
|
|
|
Callback: func(args []interface{}) (interface{}, error) {
|
|
|
|
|
return time.Now().UTC().Format(time.RFC3339), nil
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// interpolationFuncTitle implements the "title" function that returns a copy of the
|
|
|
|
|
// string in which first characters of all the words are capitalized.
|
|
|
|
|
func interpolationFuncTitle() ast.Function {
|
|
|
|
|
|