Created
May 21, 2021 03:02
-
-
Save pivotaljohn/e7a77ab1af0765d97d838bf575927bd0 to your computer and use it in GitHub Desktop.
Example 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:template", "template") | |
#! First, capture the YAML document in a "Fragment Function" | |
#! | |
#@ def my_template(foo): | |
--- | |
field1: #@ foo + "1" | |
field2: #@ foo + "2" | |
#@ end | |
#@ def another_template(prefix): | |
#@ return my_template(prefix + "-yada-") | |
#@ end | |
#! Again, in the same file, I start a YAML document (`---`), and replace it with the document produced by `another_template()`, passing in the value for `foo`: | |
--- #@ template.replace(another_template("a")) | |
--- #@ template.replace(another_template("b")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment