The tswitch
command line tool switches between different versions of terraform and terragrunt looking for constraints in terragrunt.hcl
file. If you wish to use other methods, there are other switches that you may use.
The tswitch
command also supports OpenTofu as an alternative to terraform. Refer to the flags or configuration file details below for instructions on how to switch between Terraform implementations.
- Go to the Releases Page.
- Downloading the binary for your operating system: e.g., if you’re on a Mac, download tswitch_darwin_amd64; if you’re on Windows, download tswitch_windows_amd64.exe, etc.
- Rename the downloaded file to
tswitch
. - Add execute permissions to the binary. E.g., On Linux and Mac:
chmod u+x tswitch
. - Put the binary somewhere on your PATH. E.g., On Linux and Mac:
mv tswitch /usr/local/bin/tswitch
.
Just point to a terragrunt file, ex:
tswitch -terragrunt /some/path/terragrunt.hcl
# Help to see all available options
tswitch -help
Your terragrunt.hcl
must have the constraints declared, ex:
terragrunt_version_constraint = ">= 0.26, < 0.27"
terraform_version_constraint = ">= 0.13, < 0.14"
All command line options are also supported by a configuration file, ex:
terragruntFile: ./terragrunt.hcl
installDir: /tmp/tswitch/bin
cacheDir: /tmp/tsiwtch/data
terraformImplementation: terraform # valid values are terraform or tofu
Use the flag -config
to set the path for a configuration file.
Please open issues here: New Issue
This code is released under the GNU GENERAL PUBLIC LICENSE. See LICENSE.