Interpolation
Variables within variables
Introduction
Oftentimes, you will need to define variables whose values depend on other variables.
To do this, you can use Value interpolation.
Starting with some examples always works best in these cases.
Some Examples
-
An environment variable identifier containing a complete identifier for your Bunnyshell environment.
{{ project.name }} : {{ org.name }} : {{ env.name }}
-
A variable that is using the identifier variable to create a logging content prefix.
{{ "now"|date("m/d/Y") }} {{ env.var.identifier|lower }}
-
A variable that interpolates a conditional value
{% if env.type == 'ephemeral' %}true{% else %}false{% endif %}
Where to use value interpolation
- Variables (at Project, Environment, or Component level)
- Docker-compose Components or DockerImage Components
- Build arguments
- Build context
- Build Dockerfile
- Build target
- Helm Charts
- Values
- Terraform
- Input variables
- Configuration variables
- Environment variables
- Static applications build command
Available interpolation values
- Organization variables
org.name
org.unique
- Project variables
project.name
- Environment variables
env.unique
env.name
env.type - primary / ephemeral
env.k8s.namespace
env.vars.NAME
- Components variables
components.COMPONENT_NAME.gitBranch
components.COMPONENT_NAME.ingress.hosts[*]
components.COMPONENT_NAME.vars.NAME
Updated 5 months ago