Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions terraform/envs/general/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ module "dirsync" {
LogRetentionDays = var.LogRetentionDays
SyncFrequency = "rate(1 hour)"
SnsArn = var.SnsArn
PrioritySnsArn = var.PrioritySnsArn
}
5 changes: 5 additions & 0 deletions terraform/envs/general/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ variable "SnsArn" {
type = string
default = "arn:aws:sns:us-east-2:898906883758:DiscordGeneralAlerts"
}

variable "PrioritySnsArn" {
type = string
default = "arn:aws:sns:us-east-2:898906883758:PriorityDiscordAlerts"
}
20 changes: 19 additions & 1 deletion terraform/modules/dirsync/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ resource "aws_lambda_function" "this" {
timeout = 900
memory_size = 2048
source_code_hash = data.archive_file.lambda_code.output_sha256
# reserved_concurrent_executions = 1
reserved_concurrent_executions = 1
description = "GSuite Sync Lambda."
environment {
variables = {
Expand Down Expand Up @@ -132,3 +132,21 @@ resource "aws_cloudwatch_metric_alarm" "no_invocation" {
FunctionName = local.sync_lambda_name
}
}

resource "aws_cloudwatch_metric_alarm" "repeated_errors" {
alarm_name = "${local.sync_lambda_name}-repeated-errors"
alarm_description = "GSuite Directory Sync lambda has had multiple errors in the past 12 hours."
namespace = "AWS/Lambda"
metric_name = "Errors"
statistic = "Sum"
period = "43200" # 12 hours
evaluation_periods = "1"
comparison_operator = "GreaterThanThreshold"
threshold = "6"
alarm_actions = [
var.PrioritySnsArn
]
dimensions = {
FunctionName = local.sync_lambda_name
}
}
4 changes: 4 additions & 0 deletions terraform/modules/dirsync/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ variable "SyncFrequency" {
variable "SnsArn" {
type = string
}

variable "PrioritySnsArn" {
type = string
}
Loading