Terraform is a tool for building, changing, and destroying infrastructure on your local machine or in the cloud. This tutorial will walk you through installing Terraform on Linux and Windows.
The “download terraform for windows” is a command-line tool that allows users to create, manage, and deploy infrastructure. Terraform can be used on Linux or Windows systems.
Are you feeling overburdened by the quantity of cloud services and resources you’re responsible for? Do you know what tool may assist you with these tasks? Don’t be a skeptic any longer, and get right in! This guide will show you how to set up Terraform!
Terraform is the most popular automation tool for rapidly and efficiently building, changing, and managing your cloud infrastructure. So let’s get this party started!
Prerequisites
This Terraform how-to will be a step-by-step guide. If you want to follow along, make sure you have the following items on hand:
- A computer running Windows 10 or later.
- A computer running Ubuntu 18.04 or later. Ubuntu 18.04 will be used in the examples in this guide.
Terraform on a Windows Device Installation
To get started, follow the instructions below to install Terraform on a Windows machine.
1. Open your preferred browser and go to HashiCorp’s Terraform releases website to get the relevant version of Terraform. Version 1.0.6 is used in the examples.
The most recent Terraform version is 1.0.6 at the time of writing. This version will be used in the examples.
2. In your C: drive, create a tools folder.
3. Extract the downloaded ZIP file and paste terraform.exe into the C:tools folder you previously established.
4. Next, enter your Start Menu and search for environment system; the first search result should be Edit the System Environment Variables. When you click on the search result, the System Properties box appears, as seen below.
Editing the Environment Variables in the System
5. To update the Path environment variable, locate it and click Edit.
Adding the Terraform executable path to the Path.
6. Click New, then enter C:toolsterraform.exe as the folder directory where you extracted terraform.exe, then click OK.
Changing the PATH environment variable to include the Terraform path
The version is included in the sub-directory path shown above; however, this is optional.
7. Check whether Terraform is appropriately added to the environmental variable PATH using a Command Prompt or PowerShell. If you run the terraform command, you should get something like this.
Identifying if Terraform is installed
8. It’s also a good idea to execute the terraform —version command to see what version of Terraform you have installed. If you’re following along, you should see 1.0.6.
Verifying the Terraform version installed
Installing Terraform on Ubuntu Using Package Repositories
Now you’ll see how to set up Terraform on Linux, namely Ubuntu. With the apt install command, you’ll install Terraform through package repositories for better interaction with configuration management systems.
1. Use your chosen SSH client to connect to an Ubuntu system.
2. Make a directory in which your Terraform installation files will be stored. Although Terraform may be installed in any directory, it is advised that software be installed in the opt directory. The mkdir command is used to create the terraform directory. Use the cd command to go to that directory, as illustrated below.
# Creating and shifting to the terraform directory under opt. mkdir /opt/terraform cd /opt/terraform
The Terraform directory is being created.
3. Next, use the curl command to tell your system to trust the HashiCorp key for package authentication. You’ll receive an OK message once you execute the command. Your Ubuntu device’s connection to the Hashicorp website is now safe.
Although the root user is used in this article, it is usually advisable to use a less-privileged account from the sudoers group.
sudo apt-key add – curl -fsSL https://apt.releases.hashicorp.com/gpg
Adding the key to the Ubuntu system to trust the HashiCrop site
4. After registering the key, use the apt-add-repository command to add the official HashiCorp repository to your system. The Terraform installation package may be found in the Hashicorp repository.
apt-add-repository sudo “[arch=$(dpkg —print-architecture)] deb [arch=$(dpkg —print-architecture)] https://apt.releases.hashicorp.com main $(lsb release -cs)”
On the Ubuntu system, add the HashiCrop repository.
5. Using the apt install command, install Terraform from the newly added Hashicorp repository.
terraform sudo apt install
On an Ubuntu system, installing the terraform package
6. Run the terraform command to verify your Terraform installation. You should get something like this as a result.
The terraform installation is being double-checked.
Using Zip Files to Install Terraform on Any Linux Device
The apt utilities aren’t available on every Linux distribution. Install Terraform from zip files as an option. Let’s see how we can make it happen!
1. Create the /opt/terraform directory and use the mkdir and cd commands to go to it, as shown below.
# Creating and shifting to the terraform directory under opt. mkdir /opt/terraform cd /opt/terraform
The Terraform directory is being created.
2. Go to HashiCorp’s Terraform releases website and download the relevant Terraform version. The sample below uses wget to download version 1.0.6 to the current directory.
https://releases.hashicorp.com/terraform/1.0.6/terraform 1.0.6 linux amd64.zip wget https://releases.hashicorp.com/terraform/1.0.6/terraform 1.0.6 linux amd64.zip
Terraform 1.0.6 is now available for download.
3. Use the unzip command to extract the Terraform package to the current directory after a successful download.
terraform 1.0.6 linux amd64.zip should be unzipped.
Confirm that the terraform binary file exists using the ls command.
to the current directory, extract the Terraform archive
4. Now, copy the terraform binary to the /usr/local/bin executable directory. You can launch executable files from anywhere on the Linux system if you use the executable directory (/usr/local/bin).
mv terraform /usr/local/bin sudo
Finally, execute the terraform —version command to see whether terraform was successfully installed.
Conclusion
You learnt how to install Terraform on Ubuntu and Windows devices in this article. What are your plans for Terraform now that you’ve downloaded and installed it?
The “brew install terraform” is a command-line tool that can be used to install Terraform on Linux and Windows.
Related Tags
- install terraform on windows 10
- terraform install specific version
- uninstall terraform
- terraform version