resource "azurerm_monitor_autoscale_setting" "test" {
name = "AutoscaleSetting"
resource_group_name = "${azurerm_resource_group.main.name}"
location = "${azurerm_resource_group.main.location}"
target_resource_id = "${azurerm_app_service_plan.main.id}"
profile {
name = "defaultProfile"
capacity {
default = 1
minimum = 1
maximum = 10
}
rule {
metric_trigger {
metric_name = "Percentage CPU"
metric_resource_id = "${azurerm_app_service_plan.main.id}"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "GreaterThan"
threshold = 80
}
scale_action {
direction = "Increase"
type = "ChangeCount"
value = "1"
cooldown = "PT1M"
}
}
rule {
metric_trigger {
metric_name = "Percentage CPU"
metric_resource_id = "${azurerm_app_service_plan.main.id}"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 80
}
scale_action {
direction = "Decrease"
type = "ChangeCount"
value = "1"
cooldown = "PT1M"
}
}}
我尝试在 azure 上的 terraform 中设置自动缩放规则。这样做时会引发此错误。请帮忙。这个错误是什么?如何解决这个错误?
错误:创建自动缩放设置“AutoscaleSetting”(资源组“sm-prod-resources”)时出错:insights.AutoscaleSettingsClient#CreateOrUpdate:响应请求失败:StatusCode=400 - 原始错误:autorest/azure:服务返回错误。Status=400 Code="UnsupportedMetric" Message="抛出了 'Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException' 类型的异常。"