Skip to content

Instantly share code, notes, and snippets.

@DanielDaCosta
Created September 12, 2020 18:57
Show Gist options
  • Select an option

  • Save DanielDaCosta/b4f9eac62c8ffeee109876864b6e641a to your computer and use it in GitHub Desktop.

Select an option

Save DanielDaCosta/b4f9eac62c8ffeee109876864b6e641a to your computer and use it in GitHub Desktop.
resource "aws_cloudwatch_metric_alarm" "lambda_alarm" {
for_each = length(keys(local.alarms_dimensions)) > 0 ? local.alarms_dimensions : {}
alarm_name = "${each.key}-alarm"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 1
metric_name = "Errors"
namespace = "AWS/Lambda"
period = "60"
statistic = "Sum"
threshold = 0
datapoints_to_alarm = 1
alarm_actions = [aws_sns_topic.sns_alarms.arn]
alarm_description = "Triggerd by errors in lambdas"
treat_missing_data = "notBreaching"
dimensions = each.value
tags = {
Product = local.name_dash
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment