Terraform Azure is pretty much a stable, mature provider. However, there are few errors that could occur for some “random” reason, and this time Error ensuring Resource Providers are registered
is one of them. Had this particular issue while testing some Azure AD module via Terraform Cloud (TFC). A more explanatory TFC error message could be found below.
Error: Error ensuring Resource Providers are registered. Terraform automatically attempts to
register the Resource Providers it supports to ensure it's able to provision resources.
If you don't have permission to register Resource Providers you may wish to use the
"skip_registration_provider" flag in Provider block to disable the functionality.
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 indicate either that the Resource Provider "Microsoft.Foo" requires registration,
but this could also indicate that this Azure Region doesn't support this API version.
Prerequisites
- Terraform
- Azure account
Solution
Open your providers.tf
file and update the provider "azurerm"
code block. The key point here is the skip_registration_provider
flag as described in the error output above. The fix would look something like the following one:
provider "azurerm" {
skip_provider_registration = "true"
features {}
}
Conclusion
If you have any other great solutions on this topic, or even issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.