Jinja2 is a templating language.


Jinja2 is optional and considered “advanced”.

Jinja2 variable substitutions

One popular use of Jinja2 is for variable substitutions and expansions.

In this example we use a substitution to define the vpc_cidr.

vpc_cidr: {{ vpc_cidr }}

When the time comes to create a new VPC, we pass an extra variable using -e.

For example, to set the vpc_cidr to

bf create dogtest01 -e 'vpc_cidr=' webapp.yaml

Jinja2 default filter

In this example we will use a Jinja2 filter called default.

Like our example from before, but this time setting a default.

vpc_cidr: {{ vpc_cidr | default( }}

Now the user may omit the extra variables and we will use the default.