重复阿拉姆的地形参数

问题描述 投票:0回答:1

我想在各种服务上使用Teraform设置相同的警报。例如,下面的警报需要在5个数据流上设置。我不想为5种不同的流剪切并粘贴到5次以下。可以为数据流传递参数吗local.kinesis_stream_name?

resource "aws_cloudwatch_metric_alarm" "iterator_age" {
  alarm_name                = "${local.kinesis_stream_name}-iterator-age"
  comparison_operator       = "GreaterThanOrEqualToThreshold"
  evaluation_periods        = "2"
  metric_name               = "GetRecords.IteratorAgeMilliseconds"
  namespace                 = "AWS/Kinesis"
  period                    = "300"
  statistic                 = "Maximum"
  threshold                 = "21600000"                                                                         // 6 hours
  alarm_description         = "An iterator is behind by more than 6 hours. Data loss can occur within 18 hours."
  insufficient_data_actions = []
  alarm_actions             = ["${var.alert_topic_arn}"]
  actions_enabled           = "${local.enable_alarms}"

  dimensions = {
    StreamName = local.kinesis_stream_name
  }
}
terraform
1个回答
0
投票

以下不起作用。

resource "aws_cloudwatch_metric_alarm" "iterator_age" {
  count  = "${local.queue_count}"
  alarm_name                = "${local.kinesis_stream_name[0]}-iterator-age"
  comparison_operator       = "GreaterThanOrEqualToThreshold"
  evaluation_periods        = "2"
  metric_name               = "GetRecords.IteratorAgeMilliseconds"
  namespace                 = "AWS/Kinesis"
  period                    = "300"
  statistic                 = "Maximum"
  threshold                 = "21600000"                                                                         // 6 hours
  alarm_description         = "An iterator is behind by more than 6 hours. Data loss can occur within 18 hours."
  insufficient_data_actions = []
  alarm_actions             = ["${var.alert_topic_arn}"]
  actions_enabled           = "${local.enable_alarms}"

  dimensions = {
    StreamName = local.kinesis_stream_name[0]
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.