Skip to content

Commit

Permalink
fix: suppress CloudWatch errors for email validation (#333)
Browse files Browse the repository at this point in the history
Update the API CloudWatch error alarm so that invalid email
address validation messages no longer trigger the alarm.
  • Loading branch information
patheard authored Jan 9, 2024
1 parent 007cb75 commit f6e8831
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion terragrunt/aws/api/cloudwatch_api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ resource "aws_cloudwatch_log_metric_filter" "lambda-429-errors" {

resource "aws_cloudwatch_log_metric_filter" "lambda-api-errors" {
name = "api-errors"
pattern = "?ERROR ?Error ?error"
pattern = local.api_error_metric_pattern
log_group_name = "/aws/lambda/${aws_lambda_function.api.function_name}"

metric_transformation {
Expand Down
11 changes: 11 additions & 0 deletions terragrunt/aws/api/cloudwatch_locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
locals {
api_errors = [
"ERROR",
"Error",
"error",
]
api_errors_skip = [
"email_address Not a valid email address",
]
api_error_metric_pattern = "[(w1=\"*${join("*\" || w1=\"*", local.api_errors)}*\") && w1!=\"*${join("*\" && w1!=\"*", local.api_errors_skip)}*\"]"
}

0 comments on commit f6e8831

Please sign in to comment.