Re:Terraform 0.15 General Availability
by llbeansandrice on Wednesday April 14, 2021 @04:03PM
(#26812303)
We had this issue as well where another team was on 0.12 and we were still on 11 and even running a plan I think could ruin the state.
We now have all of the systems tf version pinned:
``` terraform { required_version = "= 0.12.29" ... } ```
As other said tfenv let's you easily switch between versions but you don't get a warning if you're accidentally on 0.12 but the repo is currently using something else.
We use this https://github.com/tfutils/tfenv
Re:Terraform 0.15 General Availability
by yjftsjthsd-h on Wednesday April 14, 2021 @03:51PM
(#26812159)
I'm a fan of tfenv for this; it's really easy to use and makes it trivial to pin each stack to an exact version of TF.
Between rbenv, tfenv, pyenv, sdkman and so on and so forth, maybe it's time for some sort of common OS-level env-management interface...?
Re:Terraform 0.15 General Availability
by darkwater on Wednesday April 14, 2021 @04:19PM
(#26812490)
Maybe asdf? https://github.com/asdf-vm/asdf
Re:Terraform 0.15 General Availability
by diroussel on Wednesday April 14, 2021 @04:58PM
(#26812979)
I use asdf and it’s great. You keep your versions in .tool-versions abs when you switch for branches you automatically get the right versions of node, java, terraform etc on your path.
Re:Terraform 0.15 General Availability
by busterarm on Wednesday April 14, 2021 @08:20PM
(#26814792)
Using this. It's fantastic.
Re:Terraform 0.15 General Availability
by 0xbadcafebee on Wednesday April 14, 2021 @05:13PM
(#26813170)
You can whip up something pretty quickly as a shell wrapper and add to it as you need. I just threw this together: https://gist.github.com/peterwwillis/755002d6d3849af5bbc6cb8...
$ cliv
Usage: /home/vagrant/bin/cliv [OPTS]
/home/vagrant/bin/cliv [-i] VERSION [CMD [ARGS ..]]
Opts:
-l List versions
-h This screen
-n Create a new /home/vagrant/.cliv/VERSION
-i Clear current environment
$ cliv -n tf012
$ cliv -n tf013
$ cliv -l
tf012
tf013
$ cp terraform-v12 ~/.cliv/tf012/bin/terraform
$ cp terraform-v13 ~/.cliv/tf013/bin/terraform
$ cliv tf012 terraform
Terraform v0.12.29
$ cliv tf013 terraform
Terraform v0.13.3
$ cliv -i tf012
PATH=/home/vagrant/.cliv/tf012/bin:/home/vagrant/bin:/usr/local/sbin:/usr/local/bin:
/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD=/home/vagrantI had to put a newline in your PATH because the unbroken string was borking the page layout. Sorry, it's our bug. Someday someone will show me how to fix it. Some people have come close.
Re:Terraform 0.15 General Availability
by yjftsjthsd-h on Wednesday April 14, 2021 @04:03PM
(#26812309)
That is a selling point of nix and docker, yes:) The catch is that doing it generically makes the whole thing more complicated (although I suspect nix and docker are more complex than is strictly required for that use case)
Personally I have a nix shell file pinned to the exact version of terraform (as in, commit hash on the nix-packages repo) we use in every repo and just switch to that shell before doing anything.