How to install Terraform using Chocolatey

In this blog, we will see how can we install terraform in windows machine using chocolatey.

Chocolatey is a package manager for Windows designed to automate the software lifecycle, from installation to upgrades and removal, on Windows operating systems.

For more information, please visit the official website.

Chocolatey Installation :

To install Chocolatey on a Windows machine, follow these steps:

Step 1: Press Win + X and select “Windows PowerShell (Admin)” or “Command Prompt (Admin)” from the menu. Alternatively, you can search for “cmd” or “PowerShell” in the Start menu, right-click it, and choose “Run as administrator.”

Step 2 : Run the below command in command prompt.

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Step 3: Verify the Installation

choco --version

Step 4: Terraform Installation

Terraform is a very useful tool for creating and modifying infrastructure in an efficient manner. It supports a wide range of service providers, including both well-known and custom in-house solutions.

For more information, please visit the official website: Terraform.

choco install -y terraform

Step 5 : Check terraform

Option 2: Let’s say if you don’t want to use Chocolatey to install terraform.

Step 1: In that case download Terraform from official website.

Step 2: Save in your local C drive location.

Step 3: To update the location of the Terraform folder in your environment variables on Windows, follow these steps:

Search for environment variable. This will open the System Properties window. Click on the “Environment Variables” button.

Step 4 : In the Edit Environment Variable window, click on “New” to add a new entry or update the existing entry.

Step 5: Verify terraform using below command in powershell.

terraform --version

Leave a Reply

Your email address will not be published. Required fields are marked *