Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.


Terraform - Windows Install

This runbook guides you through the process of installing Terraform on a Windows system. Terraform is an open-source infrastructure as code software tool that enables you to safely and predictably create, change, and improve infrastructure.

Introduction

Before beginning the installation process, it is important to understand that Terraform is distributed as a single binary. Installing Terraform on Windows involves downloading the appropriate version for your system, extracting it, and configuring your system to recognize the Terraform command.

Determine OS Architecture

To ensure you download the correct Terraform binary for your system, first determine your Windows operating system architecture:

  1. Open a Powershell Admin Prompt. This can be done by right-clicking the Start menu and selecting "Windows PowerShell (Admin)".
  2. Run the following command to determine your system's architecture:

    wmic os get osarchitecture
    

    This command will return whether your system is 32-bit or 64-bit.

Download Terraform

Downloading the correct Terraform binary for your system's architecture is crucial.

  1. Visit the Terraform download page. This page lists all available versions of Terraform for various operating systems.
  2. Set Operating System to Windows.
  3. Depending on the architecture you determined earlier, select the appropriate Download link:

    • 386 for 32-bit systems.
    • AMD64 for 64-bit systems.

    Terraform Download

    The link will download a zip file containing the Terraform binary.

Extract Zip

After downloading the Terraform binary, you need to extract it to a location on your system.

  1. Right-click on the downloaded zip file terraform_(version)_windows_(architecture).zip.
  2. Select Extract all.
  3. Choose where to extract the files. For easier access and management, it is recommended to extract to C:\apps\terraform.
  4. Select Extract.

    Terraform Extract

    This action creates a folder containing the Terraform executable.

Update Path Environment Variable

To use Terraform from any command line, its location needs to be added to the Path environment variable.

  1. In the Powershell Admin prompt, run the following command to append Terraform's path to the system's Path environment variable:

    [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\apps\terraform", "Machine")
    

    This command will allow you to run Terraform from any directory in the command prompt.

Installation Check

To verify that Terraform has been installed correctly:

  1. Relaunch PowerShell. This is necessary to refresh the environment variables and include the updated Path.
  2. Run:

    terraform -v
    

    This command displays the installed version of Terraform, confirming a successful installation:

    Terraform v1.4.5
    on windows_amd64
    

Conclusion

You have now successfully installed Terraform on your Windows system. This tool will enable you to automate and manage your infrastructure with ease. Remember to periodically check for updates to ensure you have the latest features and security enhancements.


Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.