I am seeing some inconsistent behavior while deleting azure resource as part of terraform destroy plan. Most of the resources deleted successfully but some like - Network security group or network interface cannot be deleted in 1st run. So as a work around i am running the destroy again to delete the remaining resources. Do i need to follow any sequence while destroying the resources? What is the meaning of this error and how to resolve this?
Error: Error deleting Network Security Group “devNSG” (Resource Group “TerraAzure”): network.SecurityGroupsClient#Delete: Failure sending request: StatusCode=400 – Original Error: Code=“NetworkSecurityGroupOldReferencesNotCleanedUp” Message=“Network security group devNSG cannot be deleted because old references for the following Nics: (…/devNIC) and Subnet: (…/devNSG:) have not been released yet.” Details=
I don’t see this type of issue though while deleting AWS resources.
Any help would be highly appreciated.