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
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.