variable prefix {
description = "The Prefix used for all resources in this example"
}
variable location {
description = "The Azure Region in which all resources in this example should be created."
default = "westeurope"
}
output flow_logs_id {
value = azurerm_network_watcher_flow_log.nsg_logs.id
}
Debug Output
Panic Output
Expected Behavior
All resources destroyed
Actual Behavior
The azurerm_network_watcher_flow_log resource is not destroyed:
Error: Error deleting Network Security Group "repro-flowlog-issue-nsg" (Resource Group "repro-flowlog-issue"): network.SecurityGroupsClient#Delete: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidResourceReference" Message="Resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_westeurope/FlowLogs/Microsoft.Networkrepro-flowlog-issuerepro-flowlog-issue-nsg referenced by resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/repro-flowlog-issue/providers/Microsoft.Network/networkSecurityGroups/repro-flowlog-issue-nsg was not found. Please make sure that the referenced resource exists, and that both resources are in the same region." Details=[]
Steps to Reproduce
terraform init
terraform destroy
terraform destroy
Important Factoids
Manually removing the resource with az resource delete --ids yields a similar message that the resource can't be found. The resource id exported by azurerm_network_watcher_flow_log is /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_westeurope/networkSecurityGroupId/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/repro-flowlog-issue/providers/Microsoft.Network/networkSecurityGroups/repro-flowlog-issue-nsg
while this is the id of the resource created: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_westeurope/flowLogs/Microsoft.Networkrepro-flowlog-issuerepro-flowlog-issue-nsg
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_network_watcher_flow_log
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
All resources destroyed
Actual Behavior
The
azurerm_network_watcher_flow_log
resource is not destroyed:Error: Error deleting Network Security Group "repro-flowlog-issue-nsg" (Resource Group "repro-flowlog-issue"): network.SecurityGroupsClient#Delete: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidResourceReference" Message="Resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_westeurope/FlowLogs/Microsoft.Networkrepro-flowlog-issuerepro-flowlog-issue-nsg referenced by resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/repro-flowlog-issue/providers/Microsoft.Network/networkSecurityGroups/repro-flowlog-issue-nsg was not found. Please make sure that the referenced resource exists, and that both resources are in the same region." Details=[]
Steps to Reproduce
terraform init
terraform destroy
terraform destroy
Important Factoids
Manually removing the resource with
az resource delete --ids
yields a similar message that the resource can't be found. The resource id exported byazurerm_network_watcher_flow_log
is/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_westeurope/networkSecurityGroupId/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/repro-flowlog-issue/providers/Microsoft.Network/networkSecurityGroups/repro-flowlog-issue-nsg
while this is the id of the resource created:
/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_westeurope/flowLogs/Microsoft.Networkrepro-flowlog-issuerepro-flowlog-issue-nsg
References