Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissions issues on linux #54

Open
primeroz opened this issue Jul 4, 2019 · 9 comments
Open

Permissions issues on linux #54

primeroz opened this issue Jul 4, 2019 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@primeroz
Copy link

primeroz commented Jul 4, 2019

Same issue as warrensbox/terraform-switcher#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!

@Xat59
Copy link

Xat59 commented Sep 2, 2019

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 

@warrensbox warrensbox self-assigned this Oct 17, 2019
@warrensbox warrensbox added the enhancement New feature or request label Oct 17, 2019
@warrensbox
Copy link
Owner

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

  1. Create a custom binary path. Ex: mkdir /Users/username/bin (replace username with your username)
  2. Add the path to your PATH. Ex: export PATH=$PATH:/Users/username/bin (add this to your bash profile or zsh profile)
  3. Pass -b or --bin parameter with your custom path to install terragrunt. Ex: tgswitch -b /Users/username/bin/terragrunt 0.14.1

@primeroz
Copy link
Author

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

@Xat59
Copy link

Xat59 commented Mar 5, 2021

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 the tgswitch binary
  • use -b option to specify the complete path of the terragrunt symlink

@primeroz
Copy link
Author

primeroz commented Mar 5, 2021

@Xat59 what works for me is to have an alias and expand the PATH

tgswitch='$HOME/bin/tgswitch -b $HOME/bin/terragrunt'

@Xat59
Copy link

Xat59 commented Mar 5, 2021

@primeroz yeah it works after tgswitch reinstallation like I said here : #54 (comment)

@warrensbox maybe the installation instructions must be reviewed for unprivileged users like I said before

@warrensbox
Copy link
Owner

I'll add the toml file option

@Deltaxzdev
Copy link

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

@kvendingoldo
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants