Install Terraform on Mac with Homebrew (brew install terraform)
Install Terraform on macOS with Homebrew: brew tap hashicorp/tap && brew install hashicorp/tap/terraform. Includes version pinning, upgrading
Technology
Step-by-step guide to install Terraform on Ubuntu Linux using APT. Configure HashiCorp repository and verify installation.
Terraform is a powerful open-source tool created by HashiCorp that allows you to define, provision, and manage infrastructure as code. This article provides a detailed guide on installing Terraform on Ubuntu Linux, ensuring you can manage your infrastructure effectively.
Ubuntu, known for its ease of use and robustness, is a popular choice for many developers and sysadmins. Pairing it with Terraform enhances your ability to manage infrastructure seamlessly. This guide focuses on installing Terraform version 1.7.2 on Ubuntu Linux.
Before proceeding, update your package lists to ensure you have the latest versions available:
sudo apt-get update && sudo apt-get install -y gnupg software-properties-commonHashiCorp signs their packages with a GPG key. Add it to your system:
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpgVerify the fingerprint for added security:
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprintNext, add the HashiCorp repository to your system:
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.listAfter adding the new repository, update your package lists again:
sudo apt updateOutput:
Hit:1 http://ports.ubuntu.com/ubuntu-ports mantic InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports mantic-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports mantic-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports mantic-security InRelease
Get:5 https://apt.releases.hashicorp.com mantic InRelease [9,523 B]
Get:6 https://apt.releases.hashicorp.com mantic/main arm64 Packages [4,413 B]
Fetched 13.9 kB in 1s (18.7 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... DoneNow, you can install Terraform:
sudo apt install terraformOutput:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
terraform
0 upgraded, 1 newly installed, 0 to remove and 45 not upgraded.
Need to get 24.4 MB of archives.
After this operation, 80.5 MB of additional disk space will be used.
Get:1 https://apt.releases.hashicorp.com mantic/main arm64 terraform arm64 1.7.2-1 [24.4 MB]
Fetched 24.4 MB in 13s (1,943 kB/s)
Selecting previously unselected package terraform.
(Reading database ... 101523 files and directories currently installed.)
Preparing to unpack .../terraform_1.7.2-1_arm64.deb ...
Unpacking terraform (1.7.2-1) ...
Setting up terraform (1.7.2-1) ...
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.To ensure Terraform is installed correctly:
terraform --versionThis command should show the installed version of Terraform.
Terraform v1.7.2
on linux_arm64For an enhanced command-line experience, enable the autocomplete feature:
terraform -install-autocompleteRestart your shell to activate the autocomplete functionality.
Learn by doing with interactive courses on CopyPasteLearn:
You have now successfully installed Terraform on Ubuntu Linux. This setup will allow you to efficiently manage and automate your infrastructure. Regularly check for Terraform updates and explore its vast documentation to fully leverage its capabilities in your DevOps workflow.
Install Terraform on macOS with Homebrew: brew tap hashicorp/tap && brew install hashicorp/tap/terraform. Includes version pinning, upgrading
Learn how to use Terraform data sources to query existing resources, look up AMIs, reference remote state, and build dynamic configurations. Complete.
Compare Terraform and OpenTofu side by side. Understand licensing, features, compatibility, and which IaC tool is right for your organization.
Step-by-step guide to terraform import. Import existing AWS, Azure, and GCP resources into Terraform state. Includes import blocks (Terraform 1.5+)