3

Terraform script creates an aws_cloudwatch_log_metric_filter and aws_cloudwatch_metric_alarm. However in the AWS console the aws metric filter does not have an alarm associated with it yet the alarm exists in AWS console. Is there any missing steps to assign the alarm the the cloudwatcch metric? AWS console images attached.

#cloudwatch metric filter
resource "aws_cloudwatch_log_metric_filter" "titleregsubmit-metric-filter" {
  name           = "duplicate-titlregsubmit-filter-metric-${var.environment}"
  pattern        = "Submit transaction exists for VIN"
  log_group_name = var.loggroupname

  metric_transformation {
    name      = "duplicate-titlregsubmit-metric-${var.environment}"
    namespace = "MN DMV Errors 2"
    value     = "1"
  }
}


#cloud watch metric alarm
resource "aws_cloudwatch_metric_alarm" "duplicate-titleregsubmit-alarm" {
  alarm_name          = "mn-duplicate-titleregsubmit-${var.environment}"
  metric_name         = "duplicate-titlregsubmit-filter-metric-${var.environment}"
  threshold           = "0"
  statistic           = "Sum"
  comparison_operator = "GreaterThanThreshold"
  datapoints_to_alarm = "1"
  evaluation_periods  = "1"
  period              = "300"
  namespace           = "MN DMV Errors 2"
  alarm_actions       = [aws_sns_topic.nomads-alerts-sns.arn]
}

alarm

metric filter with no alarm

blueteeth
  • 3,330
  • 1
  • 13
  • 23
steve garabedian
  • 111
  • 1
  • 1
  • 4
  • 2
    Found the answer in this similar post! https://stackoverflow.com/questions/67708714/metric-filter-is-not-assigned-to-metric-alarm?rq=1 – steve garabedian Oct 31 '21 at 02:35

0 Answers0