Comments (10)
Hi, just wanted to leave my 2ct here:
Using Gitlab for ci/cd.
Gitlab allows specifying a cache from the build-dir (has to be withing the build-dir!).
It would be very helpful if there was a cli-parameter to allow changing ~/.terraform.versions/
to e.g. $PWD/.terraform.versions
.
This way the executables could be cached via Gitlabs mechanism, and there is no/less need to download these from external ressources in every pipeline.
In gitlab-ci.yml this would look sth like this;
.plan:
stage: plan
allow_failure: false
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- ${CI_PROJECT_PATH}/.terraform.versions
script:
- tfswitch -cache=$CI_PROJECT_PATH/.terraform.versions
- terraform init
- terraform validate
...
from terraform-switcher.
- Are you running
tfswitch -b $HOME/bin/terraform
ortfswitch -b $HOME/bin
? - Do you have permission to write to the
$HOME/bin
directory (what do you see when you runls -l
on $HOME?
from terraform-switcher.
- both give same result
- I am owner of $HOME/bin:
whoami
tim
ls -la $HOME | grep ' bin'
drwxrwxr-x 3 tim tim 4096 Dez 14 16:50 bin
Note:
I've uninstalled tfswitch installed using Troubleshooting guilde and installed snap package again to reproduce it again
from terraform-switcher.
From what I see here
https://snapcraft.io/docs/home-interface
https://forum.snapcraft.io/t/access-to-specific-hidden-file-path-in-users-home/6948
it looks like
- problem is in ~/.terraform.versions
- snap does not allow to use hidden (dot-prefixed) dirs in home
So either tfswitch in snap package should automatically use different folder (maybe ~/snap/tfswitch ? I see this folder has been created by snap) or at least allow to customize it.
from terraform-switcher.
@strowk perhaps I can allow users to customize it.
Thank you for bringing this up. I will find some time to do this before the end of the year. Hopefully, I can release this fix in January.
In the source code: -
getInstallLocation() //only downloads the terraform bins into the home directory in .terraform.versions
.
.
.
installLocation = usr.HomeDir + installPath //where installPath = "/.terraform.versions/"
I can make this getInstallLocation()
customizable where users can provide a location for all terraform binaries. Again, I can only get to this by the end of the year. If you know go
and would like to contribute, I would be happy to review and merge your code as well.
I will let you know once I have implemented this. Thank you for bringing this up.
from terraform-switcher.
Just want to add one note here - I see it would go better if either there would be note in installation doc and in description here https://snapcraft.io/tfswitch , that snap package requires additional configuration, or binary should somehow understand that it's running as a snap package and change path automatically. Otherwise everyone who install snap package would found themselves in this issue :)
I suspect that detection run from snap should not be very hard. Probably checking any of these env vars would do - https://snapcraft.io/docs/environment-variables
For example SNAP_USER_COMMON
seems very convenient for this task -
Directory for user data that is common across revisions of a snap.
Basically it seems that following algo would work nicely -
- if custom location is set - use it
- else check if SNAP_USER_COMMON is set. If set - use it plus /.terraform.versions/
- else use usr.HomeDir plus /.terraform.versions/
I can try to do it, does not look very hard
from terraform-switcher.
Is there any progress on this? I would actually like to use a snap version of tfswitch 👍
from terraform-switcher.
I am requesting snapcraft for access to user home:
https://forum.snapcraft.io/t/request-interface-personal-files-read-write/25277/3
If you all can upvote the issue, it would be great!
from terraform-switcher.
I also have a need to be able to set a custom the location for the .terraform.versions
directory not related to snap.
from terraform-switcher.
any progress on this one?
from terraform-switcher.
Related Issues (20)
- Latest release 1.0.0 does not support glibc 2.31 or lower HOT 2
- GLIBC 2.31 - No Longer Supported ? HOT 2
- bug: latest version of tfswitch failing glibc version HOT 2
- Version flag is not displaying the correct version HOT 4
- Implement support for multiple Terraform version constraints from the module directory
- Fix code scanning alert
- Why is the test for linux including build tasks? HOT 3
- --show-latest-pre and --show-latest-stable not working
- install.sh tries to download 1.1.0 instead of v1.1.0 HOT 3
- New version v1.1.0 does not work as expected HOT 3
- Error in v1.10 parsing version HOT 3
- Any content in terragrunt.hcl other than "terraform_version_constraint" causes tfswitch to error HOT 7
- We are facing the issue with the latest version(v1.1.0) of tfswitcher HOT 2
- v1.1.0 does not parse tf version constraint correctly HOT 5
- install.sh does not support non v-prefixed tags HOT 3
- Terraform `1.8.2` ships additional file within tarball
- Reading automatically from ~/.tfswitch.toml is broken HOT 17
- `log-level` TOML config doesn't work HOT 1
- How do I turn off logging? HOT 8
- tfswitch ignored -b argument HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-switcher.