This tutorial outlines the steps to set up Terraform on an Azure Ubuntu VM. First, update your system and install necessary packages (gnupg, software-properties-common, curl) to authenticate HashiCorp’s repository. Install the HashiCorp GPG key, verify its fingerprint, and add the official repository. Then, use sudo apt-get install terraform to install Terraform. Finally, verify the installation by running terraform -help in the terminal to ensure Terraform is ready for cloud automation in Azure.
Here we will discuss more on the terraform setup for azure ubuntu VM
Terraform Setup
Ensure that your system is up to date and you have installed the gnupg
, software-properties-common
, and curl
packages installed. You will use these packages to verify HashiCorp’s GPG signature and install HashiCorp’s Debian package repository.
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
Install the HashiCorp GPG key.
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
Verify the key’s fingerprint.
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
Add the official HashiCorp repository to your system. The lsb_release -cs
command finds the distribution release codename for your current system, such as buster
, groovy
, or sid
.
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
Download the package information from HashiCorp.
sudo apt update
sudo apt-get install terraform
Verify the installation
Verify that the installation worked by opening a new terminal session and listing Terraform’s available subcommands.
terraform -help