Why i cant delete resource group and resources inside of the group -Terraform
I try do remove this in many ways :
az group delete -n rg-terraexample
Are you sure you want to perform this operation? (y/n): y
Deployment failed. Correlation ID: 45329dc5-27e0-4c7e-86ed-4a05bbb27ba2. Operation failed with status: 'Conflict'. Details: 409 Client Error: Conflict for url: https://management.azure.com/subscriptions/8b489234-7924-464d-af72-1949c420f8a4/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SRzoyRFRFUlJBRVhBTVBMRS1XRVNUVVMyIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMyIn0?api-version=2020-06-01
by ui:
Failed to delete resource group rg-terraexample: Deletion of resource group 'rg-terraexample' failed as resources with identifiers 'Microsoft.Network/networkSecurityGroups/nsg-sshallow-terraexample-001,Microsoft.Network/publicIPAddresses/pip-vmterraform-dev-westus2-001,Microsoft.Network/virtualNetworks/vnet-dev-westus2-001' could not be deleted. The provisioning state of the resource group will be rolled back. The tracking Id is 'c6f13bf0-b8e1-4f79-bcf9-754b8837defd'. Please check audit logs for more details. (Code: ResourceGroupDeletionBlocked) Network security group /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/networkSecurityGroups/nsg-sshallow-terraexample-001 cannot be deleted because it is in use by the following resources: /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/networkInterfaces/nic-01-vmterraform-dev-001. In order to delete the Network security group, remove the association with the resource(s). To learn how to do this, see aka.ms/deletensg. (Code: InUseNetworkSecurityGroupCannotBeDeleted, Target: /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/networkSecurityGroups/nsg-sshallow-terraexample-001) Public IP address /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/publicIPAddresses/pip-vmterraform-dev-westus2-001 can not be deleted since it is still allocated to resource /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/networkInterfaces/nic-01-vmterraform-dev-001/ipConfigurations/niccfg-vmterraform. In order to delete the public IP, disassociate/detach the Public IP address from the resource. To learn how to do this, see aka.ms/deletepublicip. (Code: PublicIPAddressCannotBeDeleted, Target: /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/publicIPAddresses/pip-vmterraform-dev-westus2-001) Subnet snet-dev-westus2-001 is in use by /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/networkInterfaces/nic-01-vmterraform-dev-001/ipConfigurations/niccfg-vmterraform and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet. (Code: InUseSubnetCannotBeDeleted, Target: /subscriptions/8b489234-7924-464d-af72-1949c420f8a4/resourceGroups/rg-terraexample/providers/Microsoft.Network/virtualNetworks/vnet-dev-westus2-001)
and this problem appears on my account a second time, all resources are created by terraform script and during destoring this problem starts exists.