How to install Terraform on Ubuntu

TerraForm Installation on Ubuntu | Setup Terraform on Ubuntu

How to install Terraform on Ubuntu

What is terraform?

HashiCorp Terraform is an infrastructure as a code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like computing, storage, and networking resources, as well as high-level components like DNS entries and SaaS features.

How does Terraform work?

Terraform creates and manages resources on cloud platforms and other services through its application programming interfaces (APIs). Providers enable Terraform to work with virtually any platform or service with an accessible API.

Terraform creates and manages cloud platforms and services through their APIs

The core Terraform workflow consists of three stages:

  • Write: You define resources, which may be across multiple cloud providers and services. For example, you might create a configuration to deploy an application on virtual machines in a Virtual Private Cloud (VPC) network with security groups and a load balancer.

  • Plan: Terraform creates an execution plan describing the infrastructure it will create, update, or destroy based on the existing infrastructure and your configuration.

  • Apply: On approval, Terraform performs the proposed operations in the correct order, respecting any resource dependencies. For example, if you update the properties of a VPC and change the number of virtual machines in that VPC, Terraform will recreate the VPC before scaling the virtual machines.

The Terraform workflow has three steps: Write, Plan, and Apply


Terraform Installation on Ubuntu

Terraform is used for provisioning infrastructure on Cloud. you don't need to create manually any resources in AWS.

Create a working directory

sudo mkdir -p /opt/terraform

cd /opt/terraform

Download Terraform from Hasicorp website

sudo wget https://releases.hashicorp.com/terraform/1.3.7/terraform_1.3.7_linux_386.zip

Install unzip utility and Unzip Terraform Zip file

sudo apt-get install unzip -y

sudo unzip terraform_1.3.7_linux_386.zip

Add terraform to PATH

sudo mv /opt/terraform/terraform /usr/bin/

Verify Terraform version

terraform -version

This should show a version of Terraform

Did you find this article valuable?

Support Biswajit Mohapatra by becoming a sponsor. Any amount is appreciated!