Terraform installation on Ubuntu 22.04

Terraform is an open source “Infrastructure as Code” tool, created by HashiCorp.
Terraform is a declarative coding tool, enables developers to use a high-level configuration language called HCL (HashiCorp Configuration Language) to describe the desired “end-state” cloud or on-premises infrastructure for running an application. It then generates a plan for reaching that end-state and executes the plan to provision the infrastructure.

Update package index files

sudo apt update

Add the GPG Key

wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg

Add the Repository

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list

Install Terraform by running below command

sudo apt update && sudo apt install terraform

Check the installed version of Terraform by running below command

terraform version

For e.g.

$ terraform version
Terraform v1.5.4
on linux_amd64