Skip to content

Templating

Templates are a way to define new Wombat components (similar to plugins) that are implemented by generating a Wombat config snippet from pre-defined parameter fields. This is useful when a common pattern of Wombat configuration is used but with varying parameters each time.

How to define and use templates?

A template is defined in a YAML file that can be imported when Wombat runs using the flag -t:

Terminal window
wombat -t "./templates/*.yaml" -c ./config.yaml

The template describes the type of the component and configuration fields that can be used to customize it, followed by a Bloblang mapping that translates an object containing those fields into a wombat config structure. This allows you to use logic to generate more complex configurations:

name: aws_sqs_list
type: input
fields:
- name: urls
type: string
kind: list
- name: region
type: string
default: us-east-1
mapping: |
root.broker.inputs = this.urls.map_each(url -> {
"aws_sqs": {
"url": url,
"region": this.region,
}
})