Costa Rica
Last updated: 2025-07-16
Terraform is not recognized because it's not installed or not added to your system's PATH
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 init
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (terraform:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
By command line:
-
Open your command prompt.
-
Use curl to download Terraform. Replace VERSION with the desired version number (e.g., 1.1.4):
curl -o terraform.zip https://releases.hashicorp.com/terraform/VERSION/terraform_VERSION_windows_amd64.zip
-
Use tar to extract the ZIP file:
tar -xvf terraform.zip
By GUI:
-
Go to the Terraform download page.
-
Download the appropriate package for your operating system (e.g., Windows, macOS, Linux).
-
Extract the downloaded ZIP file to a directory of your choice (e.g.,
C:\terraform).
-
Add the directory to your system's PATH:
By command line:
Assuming you have moved terraform.exe to C:\terraform, you can add this directory to the PATH using the following commandsetx PATH "%PATH%;C:\terraform"
By GUI:
-
Open the Start menu and search for
Environment Variables. -
Click on
Edit the system environment variables
-
In the System Properties window, click on
Environment Variables.
-
Under
System variables, find thePathvariable and clickEdit. -
Click
Newand add the path to the directory where you extracted Terraform (e.g.,C:\terraform). -
Click
OKto close all windows.
-
-
Open a terminal.
-
Move the Terraform binary to a directory included in your PATH (e.g.,
/usr/local/bin):sudo mv ~/Downloads/terraform /usr/local/bin/ -
Ensure the directory is in your PATH by adding the following line to your
~/.bash_profileor~/.zshrcfile:export PATH=$PATH:/usr/local/bin
-
Reload your profile:
source ~/.bash_profile # or source ~/.zshrc
-
Open a terminal.
-
Move the Terraform binary to a directory included in your PATH (e.g.,
/usr/local/bin):sudo mv ~/Downloads/terraform /usr/local/bin/ -
Ensure the directory is in your PATH by adding the following line to your
~/.bashrcor~/.profilefile:export PATH=$PATH:/usr/local/bin
-
Reload your profile:
source ~/.bashrc # or source ~/.profile
-
Open a new terminal or command prompt.
-
Run the following command to verify the installation. You should see the installed version of Terraform.
terraform -version
Now you can run the terraform init command in your project directory:
terraform initPlease ensure you create your resource group before running the configuration and deployment. This error occurs because the specified resource group does not exist.
Error: Failed to get existing workspaces: Error retrieving keys for Storage Account "examplestorageacct": storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceGroupNotFound" Message="Resource group 'RGWorkshopUserName' could not be found." but I want to create it
Please ensure you create your storage account and container for backend before running the configuration and deployment. This error occurs because the specified storage account does not exist.
Error: Failed to get existing workspaces: Error retrieving keys for Storage Account "examplestorageacct": storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.Storage/storageAccounts/examplestorageacct' under resource group 'RGWorkshopUserName' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"


