Skip to content

The build.env file

Override defaults via build.env file

By utilizing the build.env capability, you can easily change some default behaviors of the CLI. In the binbash Leverage™ Ref Architecture you will find the following build.env example as an example. This allows you to specify several configurations for the CLI, such as the Leverage-Toolbox-Image you want to use, ensuring that you are using the latest version or a specific version that you prefer based on your compatibility requirements. This helps you avoid compatibility issues and ensures that your infrastructure deployments go smoothly.

build.env file format

The build.env file format and supported parameters are the following:

# Project settings
PROJECT=bb

# General
MFA_ENABLED=false

# Terraform
TERRAFORM_IMAGE_TAG=1.2.7-0.1.4

Customizing or extending the leverage-toolbox docker image

You can locally copy and edit the Dockerfile in order to rebuild it based on your needs, eg for a Dockerfile placed in the current working directory: $ docker build -t binbash/leverage-toolbox:1.2.7-0.1.4 --build-arg TERRAFORM_VERSION='1.2.7' . In case you like this changes to be permanent please consider creating and submitting a PR.

Working principle & multiple build.env precedence

The leverage CLI has an environmental variable loading utility that will load all .env files with the given name in the current directory an all of its parents up to the repository root directory, and store them in a dictionary. Files are traversed from parent to child as to allow values in deeper directories to override possible previously existing values. Consider all files must bear the same name, which in our case defaults to "build.env". So you can have multiple build.env files that will be processed by the leverage CLI in the context of a specific layer of a Reference Architecture project. For example the /le-tf-infra-aws/apps-devstg/us-east-1/k8s-kind/k8s-resources/build.env file.