Hi L kondareddy,
I Understand the issue involving Terraform and Azure resource group deletions. I Suggest few steps you can take to resolve this,
Ensure that there are no ongoing operations on the storage account prodexamplestorageacc
. You can do this by checking the Azure Activity Log for any active tasks.
Sometimes, Terraform's dependency tree can prevent deletion if resources are still present. You can modify your Terraform provider configuration to allow deletion of resource groups even if they contain resources:
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
This setting will allow Terraform to delete the resource group regardless of the resources it contains
If Terraform is still unable to delete the resource group, you might need to manually delete the resources within the group using the Azure portal or CLI before attempting to delete the resource group again.
Ensure that your Terraform state file is up-to-date and not corrupted. You can use the terraform state rm
command to remove specific resources from the state file if necessary
After ensuring no ongoing operations and updating your Terraform configuration, try deleting the resource group again.
For more information:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/delete-resource-group?tabs=azure-powershell
https://github.com/hashicorp/terraform-provider-azurerm/issues/16155
I hope this information helps! Let us know if you have any further questions. We will be glad to assist you further.