Handlebars syntax
Here's a short guide to Handlebars syntax. For more information, consult the official Handlebars documentation.

Variables

You refer to variables like this:
1
{{ variable_name }}
Copied!
If the variable is an object with properties of its own, you can refer to them like so:
1
{{ person.firstName }}
Copied!
This is how you refer to a specific index of an array:
1
{{ people.[0] }}
Copied!

Comments

You can use Handlebars comments in your files. Commented out sections won't show up in the final rendered output.
1
{{! This comment will not show up in the output}}
Copied!
If the content you want to comment out contains }} or other Handlebars tokens, you need to use different comment style:
1
{{!-- This comment may contain mustaches like }} --}}
Copied!

If-conditions

Here's an example of if-condition:
1
{{#if some_variable}}
2
this will be included in the output
3
{{/if}}
Copied!

Iterating over collections

This is how you iterate over a collection of items:
1
{{#each securityGroupIds}}
2
- {{this}}
3
{{/each}}
Copied!
Last modified 5mo ago