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 apt upgrade?

Install Terraform

Of course HashiCorp has good documentation for you, but here were my steps.

Pre-reqs:

$ 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"

Hold Terraform

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.

Unhold Terraform

When it’s safe to upgrade, unhold it:

$ sudo apt-mark unhold terraform=0.14.8

Read more about pinning.