How to install Terraform on Debian 11

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to install Terraform on Debian 11.

Introduction

Terraform is a software configuration tool designed to enhance the automation of multiple processes. It achieves this through concepts such as infrastructure as code.

But what does it mean? It means that developers using a configuration language called HCL (HashiCorp Configuration Language) can define the characteristics of their infrastructure.

So, it has become a vital tool for many sysadmin worldwide.

We are going to install it on Debian 11 because it is a very server-friendly system, and you should always keep it in mind.

Install Terraform on Debian 11

First, open your terminal or via SSH and update the system completely

sudo apt update
sudo apt upgrade

Next, install some packages needed for installation

sudo apt install gnupg software-properties-common curl

It is highly likely that they are already on the system, but it is always good to be certain.

Terraform is not present in the Debian 11 repositories, but it has a special repository that we can use on the system to make installation easier.

To achieve this, first add it

sudo apt-add-repository "deb [arch=$$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"

You also have to add the GPG key of the repository, so you can use the repository…

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -

The next step is to refresh APT to read the new repository information.

sudo apt update

Next, you can install Terraform by running the following command

sudo apt install terraform
Install Terraform on Debian 11
Install Terraform on Debian 11

When the whole process is finished, you can verify the installed version with the command:

terraform -v

Sample output

Terraform v1.4.6
on linux_amd64

And that’s it!

Optional: Enable autocomplete for Terraform

Terraform is a CLI tool, or at least, most of it is. Therefore, it is important to have an extra help when using it and this could be the syntax autocompletion.

To achieve this, just run

terraform -install-autocomplete

Apply the changes by running

source ~/.bashrc

Now when using terraform you can press the TAB key to enable autocomplete.

If you want to try it, type terraform and then press TAB a few times, and it will show the rest of the available commands.

Enabling autocomplete feature on Terraform
Enabling autocomplete feature on Terraform

Conclusion

DevOps students cannot not know how to install Terraform. The process is simple and within everyone’s reach.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook