Closed markhoiland closed 4 years ago
This has been released in version 2.15.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:
provider "azurerm" {
version = "~> 2.15.0"
}
# ... other configuration ...
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!
Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.12.24
Affected Resource(s)
azurerm_network_watcher_flow_log
Terraform Configuration Files
resource "azurerm_network_watcher_flow_log" "flow-log-main" { count = length(var.region)
network_watcher_name = azurerm_network_watcher.my-nw[count.index].name resource_group_name = data.azurerm_resource_group.my-rg.name network_security_group_id = element(matchkeys(azurerm_network_security_group.my-nsg..id, azurerm_network_security_group.my-nsg..location, var.region), count.index) storage_account_id = azurerm_storage_account.nsg-storage[count.index].id enabled = true version = 2
retention_policy { enabled = true days = 30
} }
Debug Output
Error: Error disabling Flow Log Configuration for target "/subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Network/networkSecurityGroups/my-main-nsg" (Network Watcher "NetworkWatcher_eastasia" / Resource Group "test-rg"): network.WatchersClient#SetFlowLogConfiguration: Invalid input: autorest/validation: validation failed: parameter=parameters.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration constraint=Null value=(*network.TrafficAnalyticsConfigurationProperties)(nil) details: value cannot be null; required parameter
Expected Behavior
All NSG resources should be destroyed, including the NSG Flog Log configurations, even if Traffic Analytics is in a disabled state as configured by the Terraform code.
Actual Behavior
When destroying deployed TF resources, TF is trying to disable NSG Flow logs and expecting “Traffic Analytics” section in enabled mode. If "Traffic Analytics" is disabled, the destroy errors out and will not destroy the NSG resources.
Steps to Reproduce
terraform apply
terraform destroy
Important Factoids
When the following code to enable Traffic Analytics for the NSG Flow Logs is included, the destroy command works without issue.
traffic_analytics { enabled = true workspace_id = element(azurerm_log_analytics_workspace.my-workspace..workspace_id, count.index) workspace_region = element(azurerm_log_analytics_workspace.my-workspace..location, count.index) workspace_resource_id = element(azurerm_log_analytics_workspace.my-workspace.*.id, count.index) // interval_in_minutes = 60 } }
References