Skip to content

Instantly share code, notes, and snippets.

@pivotaljohn
Created September 7, 2022 00:42
Show Gist options
  • Save pivotaljohn/f08b255c71b5330b92dda5bd24ee8e9c to your computer and use it in GitHub Desktop.
Save pivotaljohn/f08b255c71b5330b92dda5bd24ee8e9c to your computer and use it in GitHub Desktop.
Encoding a string value with proper indenting.
#@ load("@ytt:data", "data")
#@ load("@ytt:yaml", "yaml")
#@ def config():
#@yaml/text-templated-strings
config:
inputs: |-
(@ for app, ns in data.values.logging.apps: -@)
[INPUT]
app: (@= app @)
ns: (@= ns @)
(@ end @)
#@ end
---
spec:
source:
helm:
values: #@ yaml.encode(config())
#@data/values
---
logging:
apps: [[app1, ns1], [app2, ns2]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment