opentofu / registry

The all-new opentofu.org registry!
https://search.opentofu.org
Apache License 2.0
325 stars 40 forks source link

Failed to query available provider packages for AzureRM #1037

Closed PatBolkun closed 1 month ago

PatBolkun commented 1 month ago

Thank you for reporting an issue.

I'm having an issue retrieving the provider for AzureRM when running tofu init. Here is the output:

Initializing the backend...
Initializing modules...

Initializing provider plugins...
- Finding latest version of hashicorp/tofu...
- Finding hashicorp/azurerm versions matching "4.0.1"...
- Installing hashicorp/azurerm v4.0.1...
- Installed hashicorp/azurerm v4.0.1 (signed, key ID <Masked>)

Providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://opentofu.org/docs/cli/plugins/signing/
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/tofu: provider registry     
│ registry.opentofu.org does not have a provider named registry.opentofu.org/hashicorp/tofu
│
│ All modules should specify their required_providers so that external consumers will get the correct  
│ providers when using a module. To see which modules are currently depending on hashicorp/tofu, run   
│ the following command:
│     tofu providers
│
│ If you believe this provider is missing from the registry, please submit a issue on the OpenTofu     
│ Registry https://github.com/opentofu/registry/issues/

OpenTofu Version

1.6.2

OpenTofu Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "4.0.1"
    }
  }
  required_version = ">= 1.6.2"
}

provider "azurerm" {
  features {}
  use_oidc        = true
  subscription_id = var.subscription_id != "" ? var.subscription_id : env("ARM_SUBSCRIPTION_ID")
  tenant_id       = var.tenant_id != "" ? var.tenant_id : env("ARM_TENANT_ID")
  client_id       = var.client_id != "" ? var.client_id : env("ARM_CLIENT_ID")
}
abstractionfactory commented 1 month ago

Hi @PatBolkun I cannot reproduce the issue with the code you pasted. However, the error message says you are referencing a provider called "tofu", which is almost certainly incorrect. Please check the rest of your code if you have the "tofu" string somewhere in there.

$ tofu init

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/azurerm versions matching "4.0.1"...
- Installing hashicorp/azurerm v4.0.1...
- Installed hashicorp/azurerm v4.0.1 (signed, key ID 0C0AF313E5FD9F80)

Providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://opentofu.org/docs/cli/plugins/signing/

OpenTofu has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.

OpenTofu has been successfully initialized!

You may now begin working with OpenTofu. Try running "tofu plan" to see
any changes that are required for your infrastructure. All OpenTofu commands
should now work.

If you ever set or change modules or backend configuration for OpenTofu,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
PatBolkun commented 1 month ago

I agree with you that this has to be some stray "tofu" string. I was suprisingly able to authenticate in another module with a provider source value of "registry.opentofu.org/hashicorp/azurerm" which is certainly incorrect.

Your assumption was correct, I was able to locate some tofu references in a child module using tofu instead of azurerm.

Thank you for the assistance here!

abstractionfactory commented 1 month ago

@PatBolkun I'm closing the issue, please don't hesitate to reach out if you run into any further trouble.