Skip to content

Commit

Permalink
DP-32334: add teams alert when Circuit breaker is enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Bahr authored and Justin Bahr committed Nov 18, 2024
1 parent 489ac6e commit 1dbccec
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ecs_fargate/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ resource "aws_ecs_service" "main" {
deployment_circuit_breaker {
enable = var.ecs_circuit_breaker
rollback = var.ecs_circuit_breaker

}

dynamic "volume_configuration" {
Expand Down Expand Up @@ -278,4 +279,23 @@ resource "aws_sns_topic_subscription" "cb_email_targets" {
topic_arn = aws_sns_topic.cb[0].arn
protocol = "email"
endpoint = var.ecs_circuit_breaker_alert_email[count.index]
}


module "massgov_teamsalerts" {
count = var.ecs_circuit_breaker ? 1 : 0
source = "../teamsalerts"
name = join("", [var.ecs_service_name, "Teams", "Alert"])
human_name = "${var.ecs_cluster_name} ${var.ecs_service_name} Teams Alerts"
teams_webhook_url_param_arn = "arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/${var.teams_webhook_param_arn}"
topic_map = [
{
topic_arn = aws_sns_topic.cb.arn
human_name = join("", [var.ecs_cluster_name, var.ecs_service_name, "Teams", "Alert"])
icon_url = "https://static.vecteezy.com/system/resources/previews/024/392/058/non_2x/alert-mark-failed-to-load-something-went-wrong-tap-to-retry-concept-illustration-flat-design-eps10-simple-graphic-element-for-landing-page-empty-state-ui-infographic-icon-vector.jpg"
}
]
tags = {
"application" = "massgov-teams-notifications"
}
}
4 changes: 4 additions & 0 deletions ecs_fargate/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,8 @@ variable "ecr_repo_retention" {
description = "How many images to keep in ECR Repo? [Default = 0 (disable)]"
type = number
default = 0
}
variable "teams_webhook_param_arn" {
description = "Param name for Team Webhook: "
type = string
}

0 comments on commit 1dbccec

Please sign in to comment.