Skip to content

tgenv/tgenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TGENV - Terragrunt Version Manager

Tests

lixnux macos shell

tgenvlogo

This project was forked from old project cunymatthieu/tgenv. The intention here it's keep the project alive.

Terragrunt version manager inspired by tfenv project.

Support πŸ’»

Currently tgenv supports the following OSes

  • Mac OS X (64bit)
  • Mac OS M1 (arm64)
  • Linux (64bit)

Summary πŸ”–


Installation πŸ”§

1. Cloning the repository

Check out latest version of tgenv

$ git clone --depth 1 --branch main https://github.com/tgenv/tgenv.git ~/.tgenv

Or checkout tgenv at specific tag

$ git clone --depth 1 --branch v1.0.0 https://github.com/tgenv/tgenv.git ~/.tgenv

2. Add tgenv to $PATH

Bash

Add ~/.tgenv/bin to your $PATH any way you like

$ echo 'export PATH="$HOME/.tgenv/bin:$PATH"' >> ~/.bash_profile

OR you can make symlinks for tgenv/bin/* scripts into a path that is already added to your $PATH (e.g. /usr/local/bin) OSX/Linux Only!

$ ln -s ~/.tgenv/bin/* /usr/local/bin

ZSH

Add ~/.tgenv/bin to your $PATH any way you like

$ echo 'export PATH="$HOME/.tgenv/bin:$PATH"' >> ~/.zshrc

If you use Oh My Zsh, after export just run

$ omz reload

Usage ▢️

tgenv install

Install a specific version of terragrunt

  • latest is a syntax to install latest version
  • latest:<regex> is a syntax to install latest version matching regex (used by grep -e)
$ tgenv install 0.40.2
$ tgenv install latest
$ tgenv install latest:^0.9

If you use .terragrunt-version, tgenv install (no argument) will install the version written in it.

tgenv use

Switch a version to use latest is a syntax to use the latest installed version latest:<regex> is a syntax to use latest installed version matching regex (used by grep -e)

$ tgenv use 0.40.2
$ tgenv use latest
$ tgenv use latest:^0.10

tgenv uninstall

Uninstall a specific version of terragrunt latest is a syntax to uninstall latest version latest:<regex> is a syntax to uninstall latest version matching regex (used by grep -e)

$ tgenv uninstall 0.12.1
$ tgenv uninstall latest
$ tgenv uninstall latest:^0.9

tgenv list

List installed versions

% tgenv list
0.12.15
0.12.8
0.10.0
0.9.9

tgenv list-remote

List installable versions

% tgenv list-remote
0.42.5
0.42.4
0.42.3
0.42.2
0.42.1
0.42.0
0.41.0
0.40.2
0.40.1
0.40.0
0.39.2
0.39.1
0.39.0
...

tgenv upgrade

Upgrade the version of TGEnv software to latest version

$ tgenv upgrade

The terragrunt-version file πŸ“„

If you put .terragrunt-version file on your project root, tgenv detects it and use the version written in it. If the version is latest or latest:<regex>, the latest matching version currently installed will be selected.

$ cat .terragrunt-version
0.9.9

$ terragrunt --version
terragrunt version v0.9.9

Your version of terragrunt is out of date! The latest version
is 0.7.3. You can update by downloading from www.terragrunt.io

$ echo 0.9.9 > .terragrunt-version

$ terragrunt --version
terragrunt v0.12.15

$ echo latest:^0.10 > .terragrunt-version

$ terragrunt --version
terragrunt v0.10.3

Environment Variables πŸ“¦

TGENV_AUTO_INSTALL

String (Default: true)

Should tgenv automatically install terragrunt if the version specified by defaults or a .terragrunt-version file is not currently installed.

TGENV_AUTO_INSTALL=false terragrunt plan

TGENV_DEBUG

Integer (Default: "")

Set the debug level for TGENV.

  • unset/empty-string: No debug output
  • set: Bash execution tracing

TGENV_DISABLE_COLOR

Integer (Default: "")

Disable colored output for tgenv. This variable can either be set explicitly or will be set automatically if the -no-color flag is used with the terragrunt binary.

Uninstalling 🚫

Just run:

$ rm -rf /some/path/to/tgenv

And delete the previous export $PATH .

The uninstall command is under development.

LICENSE πŸ‘

Contributing

This project requires contributions adhere to shellcheck standards which are configured in .shellcheckrc.

Shell check can be run locally in your CLI. Refer to the shell check README for installation instructions.

shellcheck test/* bin/* libexec/*

Auto Fix

Shellcheck can output diffs which can then be automatically applied to the code. See for details.

shellcheck -f diff my-script.sh | patch