direnv reads .envrc
files and auto-loads useful environment variables upon switching directories
that allow you to quickly switch between AWS profiles, EKS clusters, Terraform & Terragrunt versions or any number of
other software versions or profiles.
On Mac just:
brew install direnv
This is automatically installed as part of core software by make
in DevOps-Bash-tools repo.
For other platforms and more install details read:
https://direnv.net/docs/installation.html
Add the direnv hook to your shell $HOME/.bashrc
or similar:
eval "$(direnv hook bash)"
When you switch to a directory containing an .envrc
file for the first time it will print a warning
that you need to approve the .envrc
file.
cd
to a dir with a .envrc
and then run this allow it to automatically load this .envrc
each time in future:
direnv allow
To edit, will auto-approve when you save and exit:
direnv edit
.envrc-kubernetes - Kubernetes-configs repo
or