I am facing one issue currently when I run this command
terraform plan -var-file=/home/users/mrinal.bhaskar/ifs-dev/common.tfvars -var-file=/home/users/mrinal.bhaskar/ifs-dev/network/variables.tfvars -input=false -out=/home/users/mrinal.bhaskar/ifs-dev/network/network.tfplan -parallelism=10
It throws the below error
│ **Error:** **Provider configuration not present**
│
│ To work with
│ module.palo_alto_nat_nva_region_a.azurerm_lb_backend_address_pool.pa_pool
│ (orphan) its original provider configuration at
│ module.palo_alto_nat_nva_region_a.provider["registry.terraform.io/-/azurerm"]
│ 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.palo_alto_nat_nva_region_a.azurerm_lb_backend_address_pool.pa_pool
│ (orphan), after which you can remove the provider configuration again.
╵
╷
│ **Error:** **Provider configuration not present**
│
│ To work with module.f5_nva_region_a.azurerm_virtual_machine.f5vm01 (orphan)
│ its original provider configuration at
│ module.f5_nva_region_a.provider["registry.terraform.io/-/azurerm"] 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.f5_nva_region_a.azurerm_virtual_machine.f5vm01 (orphan), after which
│ you can remove the provider configuration again.
I have verified in the root module main.tf , the provider configuration is already defined .
Terraform provider definitions inside non-root modules are deprecated, because of the problem you are experiencing here.
You have previously created resources via a module, module.palo_alto_nat_nva_region_a with a provider configured inside it - module.palo_alto_nat_nva_region_a.provider[“Terraform Registry”]
You have now removed this module
Terraform now does not have access to the provider configuration needed to destroy these resources
It does not matter that you have a separate azurerm provider defined in the root module - Terraform has no way to know it points at the same tenant/subscription/etc.
Therefore as the error message says, Terraform now requires you to re-add a module named palo_alto_nat_nva_region_a and re-add a provider configuration within it to tell it how to destroy those resources.
One option open to you is to add a module that is defined locally - i.e.:
I have done the changes as per your recommendation. Still getting the same error.
Just want to tell you that in source field of root module main.tf file , we are referring to another repository which contains the git reference of that particular module.
In my child module , I have created a provider.tf file where all the provider related details are there as mentioned in above chat. And in the main.tf file I only have the resource creation details.
In my parent module , only the module is being called from there using main.tf file.