Terraform referencing registry.terraform.io/hashicorp/azure which does not exist

I have been unable to init or destroy due to the following error. Has anyone seen this?

➜ terraform init

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of hashicorp/azurerm from the dependency lock file
- Reusing previous version of mongodb/mongodbatlas from the dependency lock file
- Finding latest version of hashicorp/azure...
- Using previously-installed hashicorp/azurerm v2.59.0
- Using previously-installed mongodb/mongodbatlas v0.9.1
╷
│ 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
│ registry.terraform.io/hashicorp/azure
│
│ 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 am not using any custom or sub-modules just a flat folder structure.

Here is terraform providers output:

➜ terraform providers

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/azurerm] 2.59.0
├── provider[registry.terraform.io/mongodb/mongodbatlas] 0.9.1
└── provider[registry.terraform.io/hashicorp/azure]

Providers required by state:

    provider[registry.terraform.io/hashicorp/azurerm]

Here is my main.tf:

#base assets required to connect to cloud provider
# Define Terraform provider
terraform {
  required_version = ">= 0.13"
  backend "azurerm" {
    resource_group_name  = "REDACTED"
    storage_account_name = "REDACTED"
    container_name       = "tfbackend"
    key                  = "terraform.state"
  }
  required_providers { #what does this mean and why is it required.
    mongodbatlas = {
      source = "mongodb/mongodbatlas"
      version = "0.9.1"
    }

    azurerm = {
      source = "hashicorp/azurerm"
      version = "2.59.0"
    }
  }
}

provider "azurerm" {
  features {}

  subscription_id = var.subscription_id
  client_id       = var.service_principal_app_Id
  client_secret   = var.service_principal_password
  tenant_id       = var.tenant_id
}

provider "mongodbatlas" {
  public_key  = var.mongodb_atlas_api_pub_key
  private_key = var.mongodb_atlas_api_pri_key
}

locals {
  infra_version = "1.0"
}

In your other .tf configuration files are you somewhere mistakenly defining a resource like "resource azure_" instead of “resource azurerm_*” ?

1 Like

Thats exactly what i was thinking. As as you replied i did another search.

Turns out “case sensitivity” was turned on in my search.

When I searched for resource "azure_ nothing came up.

But I have resource Azure_ … doh.

Thanks for replying!

1 Like