Documentation ¶
Overview ¶
Package tools contains various functions to help with processing of the templates
Index ¶
- Variables
- func CheckFiles(files ...string) error
- func CreateTFFilename(resourceName string, tfWorkPath string) string
- func DecorateWithMultilineHandlingFunctions(additionalFuncs map[string]any) template.FuncMap
- func Escape(str string) string
- func EscapeName(s string) (string, error)
- func EscapeQuotedStringLit(s string) string
- func Float64Ptr(f float64) *float64
- func GetEOT(str string) string
- func Int64Ptr(i int64) *int64
- func IntPtr(i int) *int
- func IsMultiline(str string) bool
- func NoNewlineAtTheEnd(str string) bool
- func RemoveLastNewline(str string) string
- func StringPtr(s string) *string
- func ToJSON(o interface{}) (string, error)
- func ToList(l []string) string
Constants ¶
This section is empty.
Variables ¶
var PolicyAsHCL bool
PolicyAsHCL means that content of the policy will be generated using HCL instead of JSON file
Functions ¶
func CheckFiles ¶
CheckFiles verifies if all given files doesn't exist in filesystem
func CreateTFFilename ¶
CreateTFFilename creates full tf file path
func DecorateWithMultilineHandlingFunctions ¶ added in v1.10.0
DecorateWithMultilineHandlingFunctions adds necessary functions to escape multiline fields in exported terraform files.
func Escape ¶ added in v1.5.0
Escape is correcting values stored in terraform fields by escaping special characters
func EscapeName ¶ added in v0.9.0
EscapeName takes a string and makes it suitable for a tf resource instance name USAGE EXAMPLE: resource "akamai_appsec_waf_mode" "{{ escapename $policyName }}" {
func EscapeQuotedStringLit ¶ added in v0.9.0
EscapeQuotedStringLit returns escaped terraform string literal https://www.terraform.io/docs/language/expressions/strings.html#escape-sequences This function is based on https://github.com/hashicorp/hcl/blob/c7ee8b78101c33b4dfed2641d78cf5e9651eabb8/hclwrite/generate.go#L207-L246
func GetEOT ¶ added in v1.10.0
GetEOT generates unique delimiter word for heredoc, by default it is EOT
func IsMultiline ¶ added in v1.10.0
IsMultiline returns true if the input string contains at least one new line character
func NoNewlineAtTheEnd ¶ added in v1.10.0
NoNewlineAtTheEnd returns true if there is no new line character at the end of the string
func RemoveLastNewline ¶ added in v1.10.0
RemoveLastNewline removes the new line character if this is the last character in the string
Types ¶
This section is empty.