I have been using Terraform for a while to launch my infrastructure in AWS, Google Cloud, and Azure and I am loving it since I do not need to learn different sets of languages or syntax for different Cloud Providers.
My only challenge when it comes to Terraform is that the installation instruction in the terraform site is not as detailed as I want it to be.
So here’s a tutorial on how to install Terraform in Windows 11 and make it work in Command Prompt, Powershell, and Git Bash with instructions and screenshots you can follow.
Note: You can also follow these steps for Windows 10.
- Download Terraform binary for Windows
- Extract terraform.exe
- Add Terraform folder in Path Environment Variable
1. Download Terraform binary for Windows
Go to terraform.io/downloads.html, then scroll down and look for the Windows section. Click on 64-bit.
This will start the download of the zip file that contains the
The latest version of terraform as of writing this tutorial is 1.0.11, so the filename of my zip file is
If you are following these instructions at a later time, then the version might be updated, thus the filename should also be different. But the steps should still be the same.
2. Extract the terraform.exe
We need to extract the terraform.exe inside the zip file, then extract it to our target folder.
In my case, my target folder is in C:\Programs\Terraform\. Yours can be a different folder or directory.
Right-click on the terraform zip file and click on Extract All…
Click on Browse and go to your target folder, then click on Extract for the extraction process to start.
Once the extraction process is done, you should see terraform.exe in your target folder.
By this time, you can only run the
terraform --version command when using the Command Prompt and if you are inside the folder that contains the terraform.exe.
But if you run
terraform --version command in Powershell or Git Bash, the system will not recognize the command.
Also running the terraform command in the Command Prompt on another folder will also fail.
To solve the issue that terraform is not recognized by PowerShell, Command Prompt, and git bash, we need to add the terraform folder to the
Path Environment Variable.
3. Add Terraform folder in Path Environment Variable
Path Environment Variable is a list of where the PowerShell, Command Prompt, or Git Bash will look to find a command. If you input a command, then it is not in the
Path Environment Variable list then the command will not be recognized.
To add the Terraform folder in the
Path Environment Variable, click on the Start Menu and search for environment.
Then click on Environment Variables…
This will open the Environment Variables window.
Under the User variables for your Username, click on Path. Then click Edit.
In the Edit Environment Variable window, click on New.
Then enter the folder location where you placed your terraform.exe. You can use Browse… if you want to.
Then click OK.
When you go back to the Environment Variables window, just click OK.
Next would be to test if terraform commands are now working.
Close all instances of Powershell, command prompt, or Git Bash.
Then launch them again, and run the
terraform --version command, this time it will work.
If after following the steps above, and terraform is still not recognized then here’s another tutorial on how to fix it.
We hope this helps you install Terraform in your Windows 11.