hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

Typo in resource providers registrations error #27110

Open roy-work opened 3 months ago

roy-work commented 3 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.5.7

AzureRM Provider Version

3.116.0

Affected Resource(s)/Data Source(s)

N/A

Terraform Configuration Files

N/A

Debug Output/Panic Output

N/A

Expected Behaviour

The error message suggests the following snippet:

provider "azurerm" {
  "resource_provider_registrations = "none"
}

First, there should not be a " before resource_provider_registrations, syntactically.

Second, there is no "resource_provider_registrations" attribute to the provider, and attempting to set it as the diagnostic suggests results in the following error:

│ Error: Unsupported argument
│
│   on main.tf line 27, in provider "azurerm":
│   27:   resource_provider_registrations = "none"
│
│ An argument named "resource_provider_registrations" is not expected here.

If you attempt to follow this link in the last line of the diagnostic:

│ https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#resource_provider_registrations

… the target portion of that link is broken.

skip_provider_registration appears to be the actual name of the attribute. The actual link to the docs appears to be https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#skip_provider_registration. (And I think this is a boolean, so likely it should read skip_provider_registration = true.)

Actual Behaviour

The error message reads:

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Terraform does not have the necessary permissions to register Resource Providers.
│
│ Terraform automatically attempts to register the Azure Resource Providers it supports, to
│ ensure it is able to provision resources.
│
│ If you don't have permission to register Resource Providers you may wish to disable this
│ functionality by adding the following to the Provider block:
│
│ provider "azurerm" {
│   "resource_provider_registrations = "none"
│ }
│
│ Please note that if you opt out of Resource Provider Registration and Terraform tries
│ to provision a resource from a Resource Provider which is unregistered, then the errors
│ may appear misleading - for example:
│
│ > API version 2019-XX-XX was not found for Microsoft.Foo
│
│ Could suggest that the Resource Provider "Microsoft.Foo" requires registration, but
│ this could also indicate that this Azure Region doesn't support this API version.
│
│ More information on the "resource_provider_registrations" property can be found here:
│ https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#resource_provider_registrations

Steps to Reproduce

  1. terraform plan, where you do not have permission to register resource providers

Important Factoids

No response

References

No response

cdituri commented 3 months ago

Took a pass at this issue report and opened a PR. Cheers.