Manage terragrunt versions - the tgswitch command line tool lets you switch between different versions of terragrunt
See the code
The tgswitch command line tool lets you switch between different versions of terragrunt.
If you do not have a particular version of terragrunt installed, tgswitch will download the version you desire.
The installation is minimal and easy.
Once installed, simply select the version you require from the dropdown and start using terragrunt.
tgswitch is available for MacOS and Linux based operating systems.
Installation for MacOS is the easiest with Homebrew. If you do not have homebrew installed, click here.
brew install warrensbox/tap/tgswitch
Installation for Linux operation systems.
curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh | bash
Alternatively, you can install the binary from the source here.
tgswitch on your terminal.The most recently selected versions are presented at the top of the dropdown.
tgswitch 0.37.1 for version 0.37.1 of terragrunt.
TG_VERSION environment variable to your desired terragrunt version.
For example:export TG_VERSION=0.37.0
tgswitch #will automatically switch to terragrunt version 0.37.0
Specify a custom binary path for your terragrunt installation
mkdir /Users/uveerum/bin (replace uveerum with your username)export PATH=$PATH:/Users/uveerum/bin (add this to your bash profile or zsh profile)tgswitch -b /Users/uveerum/bin/terragrunt 0.34.0 .tgswitch.toml file in your terragrunt directory(current directory) OR in your home directory(~/.tgswitch.toml). The toml file in the current directory has a higher precedence than toml file in the home directory.tgswitch.toml file should look like this:bin = "/usr/local/bin/terragrunt"
version = "0.34.0"
tgswitch and it should automatically install the required terragrunt version in the specified binary pathNOTE
/usr/local/bin/, tgswitch will attempt to install terragrunt at $HOME/bin. Run export PATH=$PATH:$HOME/bin to append bin to PATHtgswitch need to be run under Administrator mode, and $HOME/.tgswitch.toml with bin must be defined (with a valid path) as minimum, below is an example for $HOME/.tgswitch.toml on windowsbin = "C:\\Users\\<%USRNAME%>\\bin\\terragrunt.exe"
.tgswitchrc file containing the desired versionecho "0.33.0" >> .tgswitchrc for version 0.33.0 of terragrunttgswitch in the same directory as your .tgswitchrcInstead of a .tgswitchrc file, a .terragrunt-version file may be used as well
If a terragrunt.hcl file with the terragrunt constrain is included in the current directory, it should automatically download or switch to that terragrunt version. For example, the following should automatically switch terragrunt to version 0.36.0:
terragrunt_version_constraint = ">= 0.36, < 0.36.1"
...
tgswitch --chdir terragrunt_dir
tgswitch -c terragrunt_dir
Automatically switch with bash
Add the following to the end of your ~/.bashrc file:
(Use either .tgswitchrc or .tgswitch.toml or .terragrunt-version)
cdtgswitch(){
builtin cd "$@";
cdir=$PWD;
if [ -e "$cdir/.tgswitchrc" ]; then
tgswitch
fi
}
alias cd='cdtgswitch'
Automatically switch with zsh
Add the following to the end of your ~/.zshrc file:
load-tgswitch() {
local tgswitchrc_path=".tgswitchrc"
if [ -f "$tgswitchrc_path" ]; then
tgswitch
fi
}
add-zsh-hook chpwd load-tgswitch
load-tgswitch
NOTE: if you see an error like this:
command not found: add-zsh-hook, then you might be on an older version of zsh (see below), or you simply need to loadadd-zsh-hookby adding this to your.zshrc:autoload -U add-zsh-hook
older version of zsh
cd(){
builtin cd "$@";
cdir=$PWD;
if [ -e "$cdir/.tgswitchrc" ]; then
tgswitch
fi
}
Please open issues here: New Issue
N/A
Go
82.3%
Shell
15.9%
Makefile
1.4%
Manage terragrunt versions - the tgswitch command line tool lets you switch between different versions of terragrunt
See the code
The tgswitch command line tool lets you switch between different versions of terragrunt.
If you do not have a particular version of terragrunt installed, tgswitch will download the version you desire.
The installation is minimal and easy.
Once installed, simply select the version you require from the dropdown and start using terragrunt.
tgswitch is available for MacOS and Linux based operating systems.
Installation for MacOS is the easiest with Homebrew. If you do not have homebrew installed, click here.
brew install warrensbox/tap/tgswitch
Installation for Linux operation systems.
curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh | bash
Alternatively, you can install the binary from the source here.
tgswitch on your terminal.The most recently selected versions are presented at the top of the dropdown.
tgswitch 0.37.1 for version 0.37.1 of terragrunt.
TG_VERSION environment variable to your desired terragrunt version.
For example:export TG_VERSION=0.37.0
tgswitch #will automatically switch to terragrunt version 0.37.0
Specify a custom binary path for your terragrunt installation
mkdir /Users/uveerum/bin (replace uveerum with your username)export PATH=$PATH:/Users/uveerum/bin (add this to your bash profile or zsh profile)tgswitch -b /Users/uveerum/bin/terragrunt 0.34.0 .tgswitch.toml file in your terragrunt directory(current directory) OR in your home directory(~/.tgswitch.toml). The toml file in the current directory has a higher precedence than toml file in the home directory.tgswitch.toml file should look like this:bin = "/usr/local/bin/terragrunt"
version = "0.34.0"
tgswitch and it should automatically install the required terragrunt version in the specified binary pathNOTE
/usr/local/bin/, tgswitch will attempt to install terragrunt at $HOME/bin. Run export PATH=$PATH:$HOME/bin to append bin to PATHtgswitch need to be run under Administrator mode, and $HOME/.tgswitch.toml with bin must be defined (with a valid path) as minimum, below is an example for $HOME/.tgswitch.toml on windowsbin = "C:\\Users\\<%USRNAME%>\\bin\\terragrunt.exe"
.tgswitchrc file containing the desired versionecho "0.33.0" >> .tgswitchrc for version 0.33.0 of terragrunttgswitch in the same directory as your .tgswitchrcInstead of a .tgswitchrc file, a .terragrunt-version file may be used as well
If a terragrunt.hcl file with the terragrunt constrain is included in the current directory, it should automatically download or switch to that terragrunt version. For example, the following should automatically switch terragrunt to version 0.36.0:
terragrunt_version_constraint = ">= 0.36, < 0.36.1"
...
tgswitch --chdir terragrunt_dir
tgswitch -c terragrunt_dir
Automatically switch with bash
Add the following to the end of your ~/.bashrc file:
(Use either .tgswitchrc or .tgswitch.toml or .terragrunt-version)
cdtgswitch(){
builtin cd "$@";
cdir=$PWD;
if [ -e "$cdir/.tgswitchrc" ]; then
tgswitch
fi
}
alias cd='cdtgswitch'
Automatically switch with zsh
Add the following to the end of your ~/.zshrc file:
load-tgswitch() {
local tgswitchrc_path=".tgswitchrc"
if [ -f "$tgswitchrc_path" ]; then
tgswitch
fi
}
add-zsh-hook chpwd load-tgswitch
load-tgswitch
NOTE: if you see an error like this:
command not found: add-zsh-hook, then you might be on an older version of zsh (see below), or you simply need to loadadd-zsh-hookby adding this to your.zshrc:autoload -U add-zsh-hook
older version of zsh
cd(){
builtin cd "$@";
cdir=$PWD;
if [ -e "$cdir/.tgswitchrc" ]; then
tgswitch
fi
}
Please open issues here: New Issue
N/A
Go
82.3%
Shell
15.9%
Makefile
1.4%