通过 terraform 在存储帐户上创建指标警报时出现错误 400
我已经浏览了文档并经过验证,我用于创建警报的名称是正确的
resource "azurerm_metric_alertrule" "test" {
name = "alerttestacc"
resource_group_name = "${azurerm_resource_group.main.name}"
location = "${azurerm_resource_group.main.location}"
description = "An alert rule to watch the metric Used capacity"
enabled = true
resource_id = "${azurerm_storage_account.to_monitor.id}"
metric_name = "UsedCapacity"
operator = "GreaterThan"
threshold = 20
aggregation = "Total"
period = "PT5M"
email_action {
send_to_service_owners = false
custom_emails = [
"xyz@gmail.com",
]
}
webhook_action {
service_uri = "https://example.com/some-url"
properties = {
severity = "incredible"
acceptance_test = "true"
}
}
预期:应创建警报
实际的:
azurerm_metric_alertrule.test:insights.AlertRulesClient#CreateOrUpdate:未能响应请求:StatusCode=400 -- 原始错误:autorest/azure:服务返回错误。Status=400 Code="UnsupportedMetric" Message="此资源 ID 不支持命名空间为 '' 且名称为 'UsedCapacity' 的指标