Skip to content

How Can I manipulate values during Golang Template rendering?

How Can I manipulate values during Golang Template rendering?

Solution

The Digital Rebar Provision integrates most of the Sprig Function Library in the Golang Template rendering operations. That means that you may include their string, math and flow functions into your pipelines.

Some simple examples:

{{.Param "noCamelCase/hashiCorp" | snakecase }}

# or
{{.Param "cool/tech" | regexMatch "([DRP]*)"}}

Please consult the Sprig Function Library for a full list of functions.

Note

Digital Rebar Provision blocks functions that could be used to operate on the endpoint outside of DRP template rendering for security reasons.

Additional Information

Additional resources and information related to this Knowledge Base article.

See Also

Versions

v4.0 and newer

Keywords

sprig, advanced templating, templates, content

Revision Information

KB Article     :  kb-00024
initial release:  Wed Jun 10 11:59:35 PDT 2020
updated release:  Wed Jun 10 11:59:35 PDT 2020