Fix Terraform not running even when added to Path Environment Variable in Windows 11

I have experienced that when I did the normal steps in installing terraform, the Command Prompt, PowerShell, and Git Bash still did not recognize the terraform command in Windows 11. Even when I already added the terraform.exe location in the Path Environment Variable.

It is just annoying when this happens, luckily I was able to resolve this issue.

Note: The instructions are for Windows 11, but these steps will also work in Windows 10.

Follow the steps below on how to solve terraform command not recognized even when terraform is already added to the Path Environment Variable in Windows 11.

1. Go to the folder where your terraform.exe is located. Right-Click on the file and click Run as administrator.

2. A window will then appear asking “Do you want to allow this app to make changes to your device? Haschicorp terraform“. Click Yes.

After clicking yes, nothing will happen. No alerts of the changes nor pop-up window that installation has finished. But that should have resolved the problem.

3. Close all Command Prompt, PowerShell, and Git Bash. Then re-open them and you will now be able to run terraform commands.

PowerShell
Command Prompt
Git Bash

The truth is, I have no idea why the terraform command was not working when I already listed the location of terraform.exe in the Path Environment Variable.

Since I only encountered this in my work laptop, where there are additional security agents installed, maybe the security agents are stopping my computer to check for the folders in the local Path Environment Variable for terraform to be recognized as a command.

What I am sure though is that following the steps above will help solve the problem. I do hope that you guys have Administrator privileges on your laptop so you can follow the steps above.


We hope this helps solve the issue that terraform commands are not running even when you have added terraform.exe in the Path Environment Variable.

6 thoughts on “Fix Terraform not running even when added to Path Environment Variable in Windows 11”

  1. Insightful, I had to close VS code and run as Admin.
    Launched git bash/cmd within VS code and now able to see output of terraform –version.

  2. Hi, I tested it, but it still doesn’t work. I don’t know what’s going on, but if I doubleclick on terraform.exe nothing happens. I set the environment variables and restarted my whole Laptop, but it still didn’t work. Then I did your resolve, but it didn’t work either. Neither Powershell nor cmd recognize the command terraform. Does someone has any idea what I could do?

    1. hello, do you have any update or suggestions on this? I’m currently experiencing this particular issue on windows 11.

      terraform : The term ‘terraform’ is not recognized as the name of a cmdlet, function, script file, or
      operable program. Check the spelling of the name, or if a path was included, verify that the path is
      correct and try again.
      At line:1 char:1
      + terraform fmt
      + ~~~~~~~~~
      + CategoryInfo : ObjectNotFound: (terraform:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException

  3. Try to extracht the .zip file with the option 7-zip-> unzip to “the sam folder name as the .zip one”. because the extension .exe will be deleted when you try to extract All.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.