File tree Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -38,4 +38,5 @@ module "dirsync" {
3838 LogRetentionDays = var. LogRetentionDays
3939 SyncFrequency = " rate(1 hour)"
4040 SnsArn = var. SnsArn
41+ PrioritySnsArn = var. PrioritySnsArn
4142}
Original file line number Diff line number Diff line change @@ -12,3 +12,8 @@ variable "SnsArn" {
1212 type = string
1313 default = " arn:aws:sns:us-east-2:898906883758:DiscordGeneralAlerts"
1414}
15+
16+ variable "PrioritySnsArn" {
17+ type = string
18+ default = " arn:aws:sns:us-east-2:898906883758:PriorityDiscordAlerts"
19+ }
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ resource "aws_lambda_function" "this" {
6666 timeout = 900
6767 memory_size = 2048
6868 source_code_hash = data. archive_file . lambda_code . output_sha256
69- # reserved_concurrent_executions = 1
69+ reserved_concurrent_executions = 1
7070 description = " GSuite Sync Lambda."
7171 environment {
7272 variables = {
@@ -132,3 +132,21 @@ resource "aws_cloudwatch_metric_alarm" "no_invocation" {
132132 FunctionName = local.sync_lambda_name
133133 }
134134}
135+
136+ resource "aws_cloudwatch_metric_alarm" "repeated_errors" {
137+ alarm_name = " ${ local . sync_lambda_name } -repeated-errors"
138+ alarm_description = " GSuite Directory Sync lambda has had multiple errors in the past 12 hours."
139+ namespace = " AWS/Lambda"
140+ metric_name = " Errors"
141+ statistic = " Sum"
142+ period = " 43200" # 12 hours
143+ evaluation_periods = " 1"
144+ comparison_operator = " GreaterThanThreshold"
145+ threshold = " 6"
146+ alarm_actions = [
147+ var . PrioritySnsArn
148+ ]
149+ dimensions = {
150+ FunctionName = local.sync_lambda_name
151+ }
152+ }
Original file line number Diff line number Diff line change @@ -23,3 +23,7 @@ variable "SyncFrequency" {
2323variable "SnsArn" {
2424 type = string
2525}
26+
27+ variable "PrioritySnsArn" {
28+ type = string
29+ }
You can’t perform that action at this time.
0 commit comments