Skip to content

Instantly share code, notes, and snippets.

@HariSekhon
Last active July 15, 2024 00:12
Show Gist options
  • Save HariSekhon/5273b94774836631875bae324e7a6d12 to your computer and use it in GitHub Desktop.
Save HariSekhon/5273b94774836631875bae324e7a6d12 to your computer and use it in GitHub Desktop.
tgswitch.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowledge-Base

tgswitch

Installs multiple versions of Terragrunt to ~/.terragrunt.versions and allows fast switching between them similar to what tfenv does for Terraform.

This is more recently updated than tgenv.

Install

https://github.com/warrensbox/tgswitch?tab=readme-ov-file#installation

brew install warrensbox/tap/tgswitch

or

curl -L https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh | bash

Usage

Will prompt to download a version of Terragrunt from a list of recent versions:

tgswitch

or install a specific version as an arg without the v prefix:

tgswitch 0.39.2

using environment variable (put this in direnv's .envrc):

export TG_VERSION=0.39.2

will now automatically download and switch to the above version:

tgswitch

.terragrunt-version

Instead of an environment variable you can create a file .terragrunt-version containing the version:

cat > .terragrunt-version <EOF
0.39.2
EOF

and then run tgswitch in that directory to detect the version and switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment