Installing Terraform using a script on Linux
In this recipe, we will learn how to install Terraform on a Linux machine using a script.
Getting ready
To complete this recipe, the only prerequisites are that you are running a Linux operating system and that you have an unzip utility installed. The jq
utility must be also installed, and you can install it by using the following command:
apt update && apt install jq
jq
is a tool used to perform queries on any JSON content, the documentation is available at https://stedolan.github.io/jq/manual/.
How to do itβ¦
Perform the following steps:
- Open a command-line terminal and execute the following script:
TERRAFORM_VERSION="1.3.2" RES=$(curl -sS https://api.releases.hashicorp.com/v1/releases/terraform/${TERRAFORM_VERSION}) BINARY_URL=$(echo $RES | jq -r '.builds[] | select (.os == "linux" and .arch == "amd64") | .url') wget $ BINARY_URL...