I am trying to send diagnostics log to event hub. But I am receiving following error message. Not sure if this a bug or by design on SDK .I have tried this with the log analytics. works space and everything works without any issues. Same error is receving during the terraform plan and apply.
│ Error: parsing "/subscriptions/698ad6a2-26b0-4118-ac1d-399543a5d84f/resourceGroups/rg-enmt/providers/Microsoft.EventHub/namespaces/ehn-enmt/eventhubs/ehn-enmt/authorizationRules/ehar-enmt": parsing segment "staticAuthorizationRules": parsing the AuthorizationRule ID: the segment at position 8 didn't match
│
│ Expected a AuthorizationRule ID that matched:
│
│ > /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.EventHub/namespaces/namespaceValue/authorizationRules/authorizationRuleValue
│
│ However this value was provided:
│
│ > /subscriptions/698ad6a2-26b0-4118-ac1d-399543a5d84f/resourceGroups/rg-enmt/providers/Microsoft.EventHub/namespaces/ehn-enmt/eventhubs/ehn-enmt/authorizationRules/ehar-enmt
│
│ The parsed Resource ID was missing a value for the segment at position 8
│ (which should be the literal value "authorizationRules").
│
│
│
│ with module.this.azurerm_monitor_diagnostic_setting.storage_account["storage"],
│ on ../../main.diagnostics.tf line 9, in resource "azurerm_monitor_diagnostic_setting" "storage_account":
│ 9: eventhub_authorization_rule_id = each.value.event_hub_authorization_rule_resource_id
resource "azurerm_eventhub_namespace" "this" {
name = module.naming.eventhub_namespace.name_unique
location = azurerm_resource_group.this.location
resource_group_name = azurerm_resource_group.this.name
sku = "Standard"
capacity = 2
tags = {
environment = "Production"
}
}
#Eventhub for diagnostic settings
resource "azurerm_eventhub" "this" {
name = module.naming.eventhub_namespace.name_unique
resource_group_name = azurerm_resource_group.this.name
namespace_name = azurerm_eventhub_namespace.this.name
message_retention = 7
partition_count = 2
}
resource "azurerm_eventhub_authorization_rule" "this" {
name = module.naming.eventhub_authorization_rule.name_unique
namespace_name = azurerm_eventhub_namespace.this.name
eventhub_name = azurerm_eventhub.this.name
resource_group_name = azurerm_resource_group.this.name
listen = true
send = false
manage = false
}
diagnostic_settings_storage_account = {
storage = {
name = "diag"
#workspace_resource_id = azurerm_log_analytics_workspace.this.id
eventhub_name = azurerm_eventhub.this.name
event_hub_authorization_rule_resource_id = azurerm_eventhub_authorization_rule.this.id
log_categories = ["audit", "alllogs"]
metric_categories = ["Capacity", "Transaction"]
}
}