Environement Setup

AWS Account Setup

Create a AWS Free Tier Account to get started.

Terraform Installation

Best way to install Terraform is by referring to the official documentation, finding the current version and following the procedure published there. Following are a few ways of installing terraform as part of the lab setup, however, I would recommend you to follow the official document neverthless.

Ubuntu

Follow the following steps to install Terraform on ubuntu.

wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg

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

sudo apt update && sudo apt install terraform

Windows

Visit the following link to download the Terraform executable.

Terraform for Windows.

Extract the file.

zip

Copy the extracted file.

copy

Create a new directory called Terrafrom insice C:\Program Files\

dir

Paste the file we have copied in the previous step.

paste

Copy the file path for the executable. file-path

Search for environment from your start menu. env

Then select environment variables form the window. env-select

Select Path variable and edit it. env-path-edit

Add the path that we have copied earlier. windows-path-env-paste

MacOS

There are at least two ways of installing terraform on Mac OS, either using a package manager such as homebrew, or downloading a binary and placing it in the path.

Installing with Homebrew

brew tap hashicorp/tap
brew install hashicorp/tap/terraform

validate by running

terraform -version

To update existing terraform to the latest version use the following commands,

brew update
brew upgrade hashicorp/tap/terraform

Installing with a Binary

Download the latest version of terraform from https://www.terraform.io/downloads

Following is an example of downloading and installing 1.2.8 version. However, you should modify it as per the current version available.

wget https://releases.hashicorp.com/terraform/1.2.8/terraform_1.2.8_darwin_amd64.zip
unzip terraform_1.2.8_darwin_amd64.zip
sudo mv terraform /usr/local/bin
sudo chmod +x /usr/local/bin/terraform

Validate the Installation

Open a Shell session and run terraform -v. This should produce the following output.

terraform -v

[sample output]
Terraform v1.2.8
on darwin_arm64