File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,8 @@ variable "ProjectId" {
77 type = string
88 default = " gsuite-dirsync"
99}
10+
11+ variable "SnsArn" {
12+ type = string
13+ default = " arn:aws:sns:us-east-1:898906883758:DiscordGeneralAlerts"
14+ }
Original file line number Diff line number Diff line change @@ -93,3 +93,22 @@ resource "aws_cloudwatch_event_target" "lambda_target" {
9393 target_id = " DirsyncLambdaTarget"
9494 arn = aws_lambda_function. this . arn
9595}
96+
97+
98+ resource "aws_cloudwatch_metric_alarm" "invocation_error" {
99+ alarm_name = " ${ local . sync_lambda_name } -error-invocation"
100+ alarm_description = " GSuite Directory Sync lambda threw a critical error."
101+ namespace = " AWS/Lambda"
102+ metric_name = " Errors"
103+ statistic = " Sum"
104+ period = " 300"
105+ evaluation_periods = " 1"
106+ comparison_operator = " GreaterThanThreshold"
107+ threshold = " 1"
108+ alarm_actions = [
109+ var . SnsArn
110+ ]
111+ dimensions = {
112+ FunctionName = local.sync_lambda_name
113+ }
114+ }
Original file line number Diff line number Diff line change @@ -19,3 +19,7 @@ variable "SyncFrequency" {
1919 type = string
2020 description = " EventBridge cron frequency for triggering the sync lambda"
2121}
22+
23+ variable "SnsArn" {
24+ type = string
25+ }
You can’t perform that action at this time.
0 commit comments