|
| 1 | +# Troubleshooting: Known Errors |
| 2 | + |
| 3 | +Costa Rica |
| 4 | + |
| 5 | +[](https://github.com/) |
| 6 | +[brown9804](https://github.com/brown9804) |
| 7 | + |
| 8 | +Last updated: 2025-01-29 |
| 9 | + |
| 10 | +------------------------------------------ |
| 11 | + |
| 12 | +## Content |
| 13 | + |
| 14 | +- [Terraform is not recognized](#terraform-is-not-recognized) |
| 15 | + - [Step 1: Download Terraform](#step-1-download-terraform) |
| 16 | + - [Step 2: Install Terraform](#step-2-install-terraform) |
| 17 | + - [For Windows:](#for-windows) |
| 18 | + - [For macOS:](#for-macos) |
| 19 | + - [For Linux:](#for-linux) |
| 20 | + - [Step 3: Verify the Installation](#step-3-verify-the-installation) |
| 21 | + - [Step 4: Initialize Terraform](#step-4-initialize-terraform) |
| 22 | +- [Resource Group Not Found](#resource-group-not-found) |
| 23 | +- [Resource Not Found](#resource-not-found) |
| 24 | + |
| 25 | +## Terraform is not recognized |
| 26 | + |
| 27 | +> Terraform is not recognized because it's not installed or not added to your system's PATH |
| 28 | +
|
| 29 | +``` |
| 30 | +terraform : The term 'terraform' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the |
| 31 | +spelling of the name, or if a path was included, verify that the path is correct and try again. |
| 32 | +At line:1 char:1 |
| 33 | ++ terraform init |
| 34 | ++ ~~~~~~~~~ |
| 35 | + + CategoryInfo : ObjectNotFound: (terraform:String) [], CommandNotFoundException |
| 36 | + + FullyQualifiedErrorId : CommandNotFoundException |
| 37 | +``` |
| 38 | + |
| 39 | +<p align="center"> |
| 40 | + <img width="990" alt="image" src="https://github.com/user-attachments/assets/98076919-f13a-4461-aa34-55a8bff3d1fc" /> |
| 41 | +</p> |
| 42 | + |
| 43 | + |
| 44 | +### Step 1: Download Terraform |
| 45 | + |
| 46 | +> By command line: |
| 47 | +1. Open your command prompt. |
| 48 | +2. Use curl to download Terraform. Replace VERSION with the desired version number (e.g., 1.1.4): |
| 49 | + |
| 50 | + ``` |
| 51 | + curl -o terraform.zip https://releases.hashicorp.com/terraform/VERSION/terraform_VERSION_windows_amd64.zip |
| 52 | + ``` |
| 53 | + |
| 54 | + <img width="550" alt="image" src="https://github.com/user-attachments/assets/473128f5-f146-4933-8b50-4afa59613810" /> |
| 55 | +
|
| 56 | +3. Use tar to extract the ZIP file: |
| 57 | +
|
| 58 | + ``` |
| 59 | + tar -xvf terraform.zip |
| 60 | + ``` |
| 61 | +
|
| 62 | + <img width="316" alt="image" src="https://github.com/user-attachments/assets/c81fb71b-e30b-431e-8974-306ebca51418" /> |
| 63 | +
|
| 64 | +> By GUI: |
| 65 | +1. Go to the [Terraform download page](https://developer.hashicorp.com/terraform/install). |
| 66 | +2. Download the appropriate package for your operating system (e.g., Windows, macOS, Linux). |
| 67 | +
|
| 68 | + <img width="550" alt="image" src="https://github.com/user-attachments/assets/58796ec5-9111-4d43-b5be-def40eab7922" /> |
| 69 | +
|
| 70 | +### Step 2: Install Terraform |
| 71 | +
|
| 72 | +#### For Windows: |
| 73 | +
|
| 74 | +1. Extract the downloaded ZIP file to a directory of your choice (e.g., `C:\terraform`). |
| 75 | +
|
| 76 | + <img width="479" alt="image" src="https://github.com/user-attachments/assets/a77f337f-d78d-4198-a838-bc802ef371f4" /> |
| 77 | +
|
| 78 | +2. Add the directory to your system's PATH: |
| 79 | + |
| 80 | + > By command line: <br/> `Assuming you have moved terraform.exe to C:\terraform, you can add this directory to the PATH using the following command` |
| 81 | + |
| 82 | + ``` |
| 83 | + setx PATH "%PATH%;C:\terraform" |
| 84 | + ``` |
| 85 | + |
| 86 | + |
| 87 | + <img width="550" alt="image" src="https://github.com/user-attachments/assets/dd5fc584-e6b6-4922-a8cd-38a55afb99b1" /> |
| 88 | + |
| 89 | + |
| 90 | + > By GUI: |
| 91 | + - Open the Start menu and search for `Environment Variables`. |
| 92 | + - Click on `Edit the system environment variables` |
| 93 | + |
| 94 | + <img width="550" alt="image" src="https://github.com/user-attachments/assets/495b8e1a-ca79-4103-b743-ed35ad190bec" /> |
| 95 | + |
| 96 | + - In the System Properties window, click on `Environment Variables`. |
| 97 | + |
| 98 | + <img width="299" alt="image" src="https://github.com/user-attachments/assets/c5560100-5d3b-4461-a80d-eb1c1c2ede99" /> |
| 99 | + |
| 100 | + - Under `System variables`, find the `Path` variable and click `Edit`. |
| 101 | + - Click `New` and add the path to the directory where you extracted Terraform (e.g., `C:\terraform`). |
| 102 | + - Click `OK` to close all windows. |
| 103 | +
|
| 104 | +#### For macOS: |
| 105 | +
|
| 106 | +1. Open a terminal. |
| 107 | +2. Move the Terraform binary to a directory included in your PATH (e.g., `/usr/local/bin`): |
| 108 | + ```sh |
| 109 | + sudo mv ~/Downloads/terraform /usr/local/bin/ |
| 110 | + ``` |
| 111 | +3. Ensure the directory is in your PATH by adding the following line to your `~/.bash_profile` or `~/.zshrc` file: |
| 112 | + ```sh |
| 113 | + export PATH=$PATH:/usr/local/bin |
| 114 | + ``` |
| 115 | +4. Reload your profile: |
| 116 | + ```sh |
| 117 | + source ~/.bash_profile # or source ~/.zshrc |
| 118 | + ``` |
| 119 | + |
| 120 | +#### For Linux: |
| 121 | + |
| 122 | +1. Open a terminal. |
| 123 | +2. Move the Terraform binary to a directory included in your PATH (e.g., `/usr/local/bin`): |
| 124 | + ```sh |
| 125 | + sudo mv ~/Downloads/terraform /usr/local/bin/ |
| 126 | + ``` |
| 127 | +3. Ensure the directory is in your PATH by adding the following line to your `~/.bashrc` or `~/.profile` file: |
| 128 | + ```sh |
| 129 | + export PATH=$PATH:/usr/local/bin |
| 130 | + ``` |
| 131 | +4. Reload your profile: |
| 132 | + ```sh |
| 133 | + source ~/.bashrc # or source ~/.profile |
| 134 | + ``` |
| 135 | + |
| 136 | +### Step 3: Verify the Installation |
| 137 | +1. Open a new terminal or command prompt. |
| 138 | +2. Run the following command to verify the installation. You should see the installed version of Terraform. |
| 139 | + |
| 140 | + ```sh |
| 141 | + terraform -version |
| 142 | + ``` |
| 143 | + |
| 144 | +### Step 4: Initialize Terraform |
| 145 | + |
| 146 | +Now you can run the `terraform init` command in your project directory: |
| 147 | + |
| 148 | +```sh |
| 149 | +terraform init |
| 150 | +``` |
| 151 | + |
| 152 | +## Resource Group Not Found |
| 153 | + |
| 154 | +> Please ensure you create your resource group before running the configuration and deployment. This error occurs because the specified resource group does not exist. |
| 155 | +
|
| 156 | +``` |
| 157 | +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 |
| 158 | +``` |
| 159 | + |
| 160 | +<p align="center"> |
| 161 | + <img width="990" alt="image" src="https://github.com/user-attachments/assets/14c0a4a1-4209-4c46-8a72-8132f6dbbcec" /> |
| 162 | +</p> |
| 163 | + |
| 164 | +## Resource Not Found |
| 165 | + |
| 166 | +> 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. |
| 167 | +
|
| 168 | +``` |
| 169 | +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" |
| 170 | +``` |
| 171 | + |
| 172 | +<p align="center"> |
| 173 | + <img width="990" alt="image" src="https://github.com/user-attachments/assets/6c392d1e-32c5-4929-aaf7-6cdb853cf77d" /> |
| 174 | +</p> |
| 175 | + |
| 176 | + |
| 177 | +<div align="center"> |
| 178 | + <h3 style="color: #4CAF50;">Total Visitors</h3> |
| 179 | + <img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/> |
| 180 | +</div> |
0 commit comments