generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into jitbit-revert-address-change
- Loading branch information
Showing
7 changed files
with
496 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
terraform/environments/contract-work-administration/sns.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
locals { | ||
pagerduty_integration_key_name = local.environment == "production" ? "laa_cwa_prod_alarms" : "laa_cwa_nonprod_alarms" | ||
} | ||
|
||
# SNS topic for monitoring to send alarms to | ||
resource "aws_sns_topic" "cwa" { | ||
name = "${local.application_name_short}-${local.environment}-alerting-topic" | ||
tags = merge( | ||
local.tags, | ||
{ | ||
Name = "${local.application_name_short}-${local.environment}-alerting-topic" | ||
} | ||
) | ||
} | ||
|
||
# Pager duty integration | ||
|
||
# Get the map of pagerduty integration keys from the modernisation platform account | ||
data "aws_secretsmanager_secret" "pagerduty_integration_keys" { | ||
provider = aws.modernisation-platform | ||
name = "pagerduty_integration_keys" | ||
} | ||
data "aws_secretsmanager_secret_version" "pagerduty_integration_keys" { | ||
provider = aws.modernisation-platform | ||
secret_id = data.aws_secretsmanager_secret.pagerduty_integration_keys.id | ||
} | ||
|
||
# Add a local to get the keys | ||
locals { | ||
pagerduty_integration_keys = jsondecode(data.aws_secretsmanager_secret_version.pagerduty_integration_keys.secret_string) | ||
} | ||
|
||
# link the sns topic to the service | ||
module "pagerduty_core_alerts" { | ||
depends_on = [ | ||
aws_sns_topic.cwa | ||
] | ||
source = "github.com/ministryofjustice/modernisation-platform-terraform-pagerduty-integration?ref=v2.0.0" | ||
sns_topics = [aws_sns_topic.cwa.name] | ||
pagerduty_integration_key = local.pagerduty_integration_keys[local.pagerduty_integration_key_name] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.