google cloud platform – Terraform init Error: Failed to query available provider packages
I am trying to create a pubsub topic using terraform
terraform version is 1.3.6
When I run terraform init I am getting error, can anyone help me ?
Error:
terraform init
Initializing the backend
Initializing provider plugins
-Finding hashicorp/google versions matching “>= 3.5.0″…
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/google: could not connect to registry.terraform.io: Failed to request discovery document: Get “https://registry.terraform.io/.well-known/terraform.json”: dial tcp: lookup registry.terraform.io: no such host
below is my version.tf file
terraform {
required version = ">= 1.3.6"
required_providers {
google = {
source = "hashicorp/Google"
version = ">= 3.5.0"
}
}
}
I downloaded terraform from Nexus registry
get_artifact_from_nexus "$(TERRAFORM_DIR)" 'terraform' '1.2.7'
get_artifact_from_nexus "$(TERRAFORM_DIR)" 'terraform-provider-local' '2.2.3'
get_artifact_from_nexus "$(TERRAFORM_DIR)" 'terraform-provider-null' '3.1.1'
get_artifact_from_nexus "$(TERRAFORM_DIR)" 'terraform-provider-google' '4.32.0'
get_artifact_from_nexus "$(TERRAFORM_DIR)" 'terraform-provider-google-beta' '4.32.0'
I tried changing required_providers versions to match required_version I am still getting the same error.
I previously got an error for terraform.rc by edited the file to terraform.rc.tf that error disappeared.
When I run terraform –version
I am getting Terraform v1.3.6
Read more here: Source link
