10個報警單terraform報警看起來是這樣的:在Terraform,你怎麼能輕鬆地創建每桌
resource "aws_cloudwatch_metric_alarm" "ecs_cpu_reservation" {
alarm_name = "ecs-cpu-reservation-${var.environment}"
alarm_description = "my description"
namespace = "AWS/ECS"
metric_name = "CPUReservation"
dimensions {
ClusterName = "${var.environment}"
}
statistic = "Average"
period = "300"
evaluation_periods = "${var.acceptable_cpu_reservation_eval_period}"
comparison_operator = "GreaterThanOrEqualToThreshold"
threshold = "${var.acceptable_cpu_reservation}"
alarm_actions = ["${data.terraform_remote_state.vpc.my_topic_arn}"]
actions_enabled = "${var.alerting_enabled}"
}
我有每桌10個警報,以及50桌。 因此,tf文件將包含500個這些資源塊。這是一個巨大的文件!
絕大多數的報警是相同的...唯一的區別是報警是什麼表。
有沒有辦法循環表名列表並創建警報?
從我讀到的情況來看,使用「count」變量(或迭代列表)將導致維護噩夢。