Hi
I am trying to execute “terraform init” in a new workspace and I am getting the error below:
$ terraform109 init
Initializing modules...
Initializing the backend...
Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Finding hashicorp/azurerm versions matching "2.94.0"...
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/azurerm: could not connect to registry.terraform.io: Failed
│ to request discovery document: Get "https://registry.terraform.io/.well-known/terraform.json": net/http: request canceled while
│ waiting for connection (Client.Timeout exceeded while awaiting headers)
How is the configuration:
I am working with different terraform versions (based on the project), so, for this project I am using terraform 1.0.9, that is why I executed “terraform109 init”
I validated the version as below:
$ terraform109 version
Terraform v1.0.9
on windows_amd64
The backend is configured as below:
terraform {
required_version = "1.0.9"
backend "remote" {
hostname = "correct hostname"
organization = "Organization name"
workspaces {
name = "Correct namespace"
}
}
}
The provider is configured as below:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.94.0"
}
}
}
provider "azurerm" {
features {}
}
The azurerm plugin is on the path:
PS C:\Users\User\OneDrive\Documents\Workspace\tf\folder\.terraform\plugins\windows_amd64> dir
Directory:C:\Users\User\OneDrive\Documents\Workspace\tf\folder\.terraform\plugins\windows_amd64>
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---l 1/28/2022 8:37 AM 179714352 terraform-provider-azurerm_v2.94.0_x5.exe
When I execute the command below, I get a different path:
$ terraform109 init -plugin-dir=/.terraform/plugins/windows_amd64/terraform-provider-azurerm_v2.94.0_x5.exe
Initializing modules...
Initializing the backend...
Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Finding hashicorp/azurerm versions matching "2.94.0"...
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/azurerm: provider
│ registry.terraform.io/hashicorp/azurerm was not found in any of the search locations
│
│ - C:/Program Files/Git/.terraform/plugins/windows_amd64/terraform-provider-azurerm_v2.94.0_x5.exe
I also copied the plugin in that directory specified above, however, does not work.
I already tried to create the plugin_path defining this path and did not work
C:\Users\User\OneDrive\Documents\Workspace\tf\folder\.terraform\plugins\windows_amd64>
Any suggestion?
Thank you in advance.