Closed tsunamishaun closed 2 years ago
:wave: @tsunamishaun and thanks for the question!
First, I am not familiar with Atlantis myself, can you briefly describe how it runs terraform/terragrunt at present?
As to your question, I have not tested this, but since terve uses simple hard links (e.g. ~/.terve/bin/terraform -> ~/.terve/opt/terraform/1.0.7
) to select a tool version, and does not provide shims/wrappers to run that tool version, I'm pretty sure naive concurrent use would be racy (not safe), if several processes/threads used the same terve installation (below, 1
and 2
are concurrent processes/threads):
1 terve s tf 0.12.31 ~/.terve/bin/terraform now points to 0.12.31
2 terve s tf 1.0.7 ~/.terve/bin/terraform now points to 1.0.7
1 terraform plan 1 runs terraform 1.0.7 while it expected to run 0.12.31
...
That said, here's a few potential ideas from the top of my head (NB: not necessarily disk nor bandwidth efficient), in no particular order:
~/.terve/opt/terraform/<version>
in a wrapper, one way or the other)$HOME
/$PATH
per concurrent run (terve looks at the users $HOME
, so you could have several .terve
dirs.If you used terragrunt, you could also perhaps leverage the --terragrunt-tfpath ~/.terve/opt/terraform/<version>
option.
As to extending terve itself, an exec
action such as terve e[xec] tf 0.12.31 plan
, which would fork terraform directly, could work, but I'm not sure what implications that could have (stdin/stdout, exit codes, argument passing, signaling etc), so it would require more thinking to see if it'd actually be worth the added complexity.
Closing due to inactivity
Looking to use this for replacing tgenv/tfenv in atlantis but wondering if anyone has done this yet and if its safe for concurrency (multiple versions, multiple concurrent runs)? This was an issue early on with those other projects which was fixed in an eventual refactor. Thanks for making this project!