YAML Filters
Use YAML filters when you are generating configuration or manifest-style text inside a task. They are less common in simple flows, but very useful in templated Kubernetes, Docker, or config-management patterns.
yaml
Parse YAML into an object:
{{ "foo: bar" | yaml }}This is especially useful in templated tasks where the source data starts as text but later expressions need object-style access.
Example: using yaml in a templated task
id: yaml_filter_examplenamespace: company.team
tasks: - id: yaml_filter type: io.kestra.plugin.core.log.Log message: | {{ "foo: bar" | yaml }} {{ {"key": "value"} | yaml }}indent and nindent
Useful when generating templated YAML or embedding structured content:
{{ labels | yaml | indent(4) }}{{ variables.yaml_data | yaml | nindent(4) }}Example with indent and nindent
id: templated_task_examplenamespace: company.team
labels: example: test
variables: yaml_data: | key1: value1 key2: value2
tasks: - id: yaml_with_indent type: io.kestra.plugin.core.templating.TemplatedTask spec: | id: example-task type: io.kestra.plugin.core.log.Log message: | Metadata: {{ labels | yaml | indent(4) }}
Variables: {{ variables.yaml_data | yaml | nindent(4) }}Use indent when the first line is already in place and only following lines need alignment. Use nindent when you need to start a fresh indented block on the next line.
Was this page helpful?