tgswitch
tgswitch copied to clipboard
Permissions issues on linux
Same issue as https://github.com/warrensbox/terraform-switcher/issues/33
$ tgswitch
✔ 0.18.7
lstat /usr/local/bin/terragrunt: no such file or directory
symlink /home/user/.terragrunt.versions/terragrunt_0.18.7 /usr/local/bin/terragrunt: permission denied
2019/07/04 09:32:37 Unable to create symlink. You must have SUDO privileges symlink /home/user/.terragrunt.versions/terragrunt_0.18.7 /usr/local/bin/terragrunt: permission denied
we need the same solution to use a configuration file to specify the destination bin link.
Thanks!
I can confirm that behavior .
⇒ tgswitch
✔ 0.19.21
symlink /home/xat/.terragrunt.versions/terragrunt_0.19.21 /usr/local/bin/terragrunt: file exists
2019/09/02 15:11:58 Unable to create symlink. You must have SUDO privileges symlink /home/xat/.terragrunt.versions/terragrunt_0.19.21 /usr/local/bin/terragrunt: file exists
This feature was added with MR #65. Upgrade tgswitch to get the latest version.
brew upgrade warrensbox/tap/tgswitch
Please test the latest release and let me know if there are any bugs.
Use custom installation location (For non-admin - users with limited privilege on their computers)
You can specify a custom binary path for your terragrunt installation
- Create a custom binary path. Ex:
mkdir /Users/username/bin
(replace username with your username) - Add the path to your PATH. Ex:
export PATH=$PATH:/Users/username/bin
(add this to your bash profile or zsh profile) - Pass -b or --bin parameter with your custom path to install terragrunt. Ex:
tgswitch -b /Users/username/bin/terragrunt 0.14.1
It does work but to be honest it would have been great to use the same way that "tfswitch" uses with the .toml file ... it is very likely that whoever use one tool use the other as well.
In the case of tgswitch i will have to setup an alias to the -b
option
Ok so before we need to reinstall tgswitch
with the -b
option that defines the path directory of the tgswitch
binary :
$ export PATH=$PATH:~/.local/bin
$ wget https://raw.githubusercontent.com/warrensbox/tgswitch/release/install.sh
$ bash install.sh -b ~/.local/bin
warrensbox/tgswitch info checking GitHub for latest tag
warrensbox/tgswitch info found version: 0.4.326 for 0.4.326/linux/amd64
warrensbox/tgswitch info installed /home/xat/.local/bin/tgswitch
Then, I am able to tgswitch
, but there I need to use -b
to define the complete location of the terragrunt
binary :
$ tgswitch -b ~/.local/bin/terragrunt
✔ 0.28.7
Downloading https://github.com/gruntwork-io/terragrunt/releases/download/v0.28.7/terragrunt_linux_amd64 to terragrunt_linux_amd64
Downloading ...
36705151 bytes downloaded.
Switched terragrunt to version "0.28.7"
So, to resume :
- use
-b
option when installing to define the directory path of thetgswitch binary
- use
-b
option to specify the complete path of theterragrunt
symlink
@Xat59 what works for me is to have an alias and expand the PATH
tgswitch='$HOME/bin/tgswitch -b $HOME/bin/terragrunt'
@primeroz yeah it works after tgswitch
reinstallation like I said here : https://github.com/warrensbox/tgswitch/issues/54#issuecomment-791280909
@warrensbox maybe the installation instructions must be reviewed for unprivileged users like I said before
I'll add the toml file option
siempre que intento el ./install.sh el zsh me da permission denied que pueod hacer para arreglarlo chmod -x install.sh
┌──(kali㉿kali)-[~/Desktop/DARKARMY] └─$ ./install.sh zsh: permission denied: ./install.sh
btw. you can also use tenv that support Terraform as well as OpenTofu (and Terragrunt :) ) in one tool. It allow you to simplify version management and can do much more, than tgswitch.