Ubuntu install HashiCorp Terraform and hold version
For a bunch of projects I must use Terraform version 0.14.8 and this is how I hold/unhold that version.
I am in the middle of a number of HashiCorp Terraform projects that require I use version 0.14.8, so how do I install and pin that version so it does not update with my next
Of course HashiCorp has good documentation for you, but here were my steps.
$ sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl
Add the HashiCorp GPG key:
$ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
Add the HashiCorp Linux repo:
$ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
After you have added the HashiCorp GPG Key and Repository, it’s a simple one line command to pin it:
$ sudo apt install terraform=0.14.8
You will get something like this:
$ sudo apt-mark hold terraform=0.14.8 terraform set on hold.
When it’s safe to upgrade, unhold it:
$ sudo apt-mark unhold terraform=0.14.8
2022-04-30 20:00 (Last updated: 2022-05-01 22:20)
bf054b2 @ 2022-05-01