config.yml.tpl
Secret references
Secret references included in template files can be formatted as either unenclosed secret references or enclosed secret references.Unenclosed secret references
- Begins with
op://and is not preceded by any of the characters from:alphanumeric,-,+,\,.. - Ends with either the end of the template, or the first encountered character outside the following set:
alphanumeric,-,?,_,..
Enclosed secret references
- Begins with two closed braces
{{ - Ends with the two closed braces
}} - Contains a valid unenclosed secret reference between the two pairs of braces, possibly padded with spaces
Special characters
If you need to escape special characters in your template, you can use curly braces and double quotes:\:
Variables
The template syntax also supports variable tags:$var(unenclosed variables)${var}(enclosed variables)
$FOO, it is replaced with the value of the environment variable named FOO.
When resolving an enclosed variable of the form ${FOO}, any whitespace at the beginning or end of FOO is discarded and the reference is replaced with the value of the environment variable named FOO.
Variable names are case-insensitive, cannot start with a number, and can only contain letters, numbers, and underscores.
Examples of good and bad unenclosed variables:
Default values
To set a default value for a template variable, use this syntax:${VAR_NAME:-<default-value>}
The default value will be used when the variable can’t be found in the environment.
For example, op://${VAULT:-dev}/docker/password evaluates to op://dev/docker/password when the VAULT environment variable isn’t set.
If VAULT is set to prod instead, it will evaluate to op://prod/docker/password.