I’ve rafactored my code to use modules and when I attempt to apply a module leveraging the azurerm provider in order to create a service principal and role assingments, I’m getting the following:
Error: Provider configuration not present
To work with
module.azure_arc_ds_controller.azurerm_role_assignment.contributor its
original provider configuration at
module.azure_arc_ds_controller.provider[“registry.terraform.io/hashicorp/azurerm”].azure_rm
is required, but it has been removed. This occurs when a provider
configuration is removed while objects created by that provider still exist in
the state. Re-add the provider configuration to destroy
module.azure_arc_ds_controller.azurerm_role_assignment.contributor, after
which you can remove the provider configuration again.
Error: Provider configuration not present
To work with
module.azure_arc_ds_controller.azurerm_role_assignment.monitoring_metrics_publisher
its original provider configuration at
module.azure_arc_ds_controller.provider[“registry.terraform.io/hashicorp/azurerm”].azure_rm
is required, but it has been removed. This occurs when a provider
configuration is removed while objects created by that provider still exist in
the state. Re-add the provider configuration to destroy
module.azure_arc_ds_controller.azurerm_role_assignment.monitoring_metrics_publisher,
after which you can remove the provider configuration again.
Error: Provider configuration not present
To work with module.azure_arc_ds_controller.data.azurerm_subscription.primary
its original provider configuration at
module.azure_arc_ds_controller.provider[“registry.terraform.io/hashicorp/azurerm”].azure_rm
is required, but it has been removed. This occurs when a provider
configuration is removed while objects created by that provider still exist in
the state. Re-add the provider configuration to destroy
module.azure_arc_ds_controller.data.azurerm_subscription.primary, after which
you can remove the provider configuration again.
The little I have been able to glean about this suggests that not enough info exists in the tfstate file with which terraform can delete these resources, I’m confident that these resources do not exist in Azure and I also there is nothing in the tfstate files, I’ve gone through the Azure portal and I do not seem to have any resources in existence associated with the module, as per module best practice, I’ve moved all providers into the main.tf in the root module, but I have the following in the child module:
data "azurerm_subscription" "primary" {
provider = azurerm.azure_rm
}
I wonder if this might in some way be related to the problem.