Failed to query available provider packages

I'm using the Powershell in the Azure Portal. Terraform version = v1.0.3 Powershell version = 7.1.3

this is my code

provider "azurerm" { features {}
}
resource "azure_storage_account" "lab" { name = "newbloddystoragegroup" resource_group_name = "TFResourcegroup" location = "eastus" account_tier = "Standard" account_replication_type = "LRS"
}
resource "azure_storage_container" "lab" { name = "blobcontainer4dev" storage_account_name = azure.storage.account.lab.name container_access_type = "private"
}
resource "azure_storage_blob" "lab" { name = "TerraformdevBlob" storage_account_name = azure_storage_account.lab.name storage_container_name = azure_storage_container.lab.name account_replication_type = "Block"
}
resource "azure_storage_share" "lab"{ name = "terraformdevshare" storage_account_name = azure_storage_account.lab.name quota = 50
}

but when I run terraform init..I get the following error

Initializing provider plugins...
- Finding latest version of hashicorp/azurerm...
- Finding latest version of hashicorp/azure...
- Installing hashicorp/azurerm v2.74.0...
- Installed hashicorp/azurerm v2.74.0 (signed by HashiCorp)
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/azure: provider registry registry.terraform.io does not have a provider named
│
│ Did you intend to use terraform-providers/azure? If so, you must specify that source address in each module which requires that provider. To see which modules are currently depending on hashicorp/azure, run the following command:
│ terraform providers

I've run this..

terraform providers
Providers required by configuration:
.
├── provider[
└── provider[

but I don't know what I have to change

What I've tried ...

  1. I've put
provider "azurerm" { features {}
} 

into its own provider.tf file...but I'm still getting the error

  1. I've tried to put
provider "" { features {}
} 

...but it turns out that that is unacceptable syntax

  1. I've tried replacing
provider "azurerm" { features {}
} 

with

required_providers { azurerm = { source = "hashicorp/azurerm" version = "2.74.0" }

..but that didn't work either

..any help is gratefully received....just guide me ..you don't necessarily need to tell me the answer

1 Answer

I believe you have gotten this error because you used azure_* resources

If you open Azure Provider documentation you will figure out that all resources names start with azurerm_* prefix.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like