尝试找出Terraform代码以创建一个事件,该事件将禁用特定CloudWatch警报的“警报”操作。这是我到目前为止的内容:
resource "aws_cloudwatch_event_rule" "disable_alarms" {
name = "DisableAlarms"
description = "Disable Alarms at midnight"
schedule_expression = "cron(0 0 * * ? *)"
}
resource "aws_cloudwatch_event_target" "disable_alarms" {
target_id = "DisableAlarms"
arn = "arn:aws:..."
input = "{\"commands\":[\"DisableAlarmActions\"]}"
rule = "${aws_cloudwatch_event_rule.disable_alarms.name}"
run_command_targets {
}
}
我在正确的道路上吗?有人做过吗?这是API参考,表明应该可行:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_EnableAlarmActions.html
我只是不确定如何使用Terraform来实现这一点