Search…
Value Interpolation

Introduction

Oftentimes, you will need to define variables whose values depend on other variables. To do this, you can use Value interpolation.

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 Application level)
  • Components / docker-compose:
    • 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
    The "COMPONENT_NAME" should have the value of your target component name, with all the non-alphanumerical characters replaced with underscore (_).
  • Terraform
    • tf.MODULE_NAME.input.NAME
    • tf.MODULE_NAME.output.NAME - complex values can be accessed further (ie. tf.MODULE_NAME.output.endpoints.api[0].port)

Available methods that can be used with the values interpolation

The interpolation mechanism uses Twig for rendering the values. So the syntax needs to be a valid Twig syntax.
The available Twig filters are:
  • lower
  • capitalize, date
  • date_modify
  • default
  • json_encode
  • length
  • replace
  • slice
  • slug
  • title
  • trim
  • upper
  • url_encode.
The available Twig functions are:
  • random
  • date
  • max
  • min.
Copy link
On this page
Introduction
Examples
Where to use value interpolation
Available interpolation values
Available methods that can be used with the values interpolation