Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.82 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.82 KB
The svart logo, a stylized letter S

Svart


svart is a small command-line utility for working with environment variables in Terraform. Tools like direnv or Chamber allow you to automatically export environment variables for your application configuration, e.g. from a dotenv file or from a secrets managers.

Terraform and OpenTofu require environment variables to be prefixed with TF_VAR_ before they can be read from within the configuration. If you need environment variables inside your Terraform configuration, exported by tools like direnv or chamber, they would manually need to be re-exported.

svart pre

Usage

[!NOTE] Strict Mode Svart runs in strict mode by default unless told differently. This means svart will not output anything unless allowed patterns are configured configured. Strict mode can be (temporarily) disabled by using --relaxed mode.

Imagine the following .env file:

AWS_FOO=egg
AWS_BAR=spam

An example .env file

The contents of a .env file can be re-exported by piping the contents to svart:

cat .env | svart --from-stdin --relaxed

In order to use svart in conjunction with direnv, it suffices to add the following to your .envrc file file:

<(cat .envrc | svart)

svart will ignore all the input