diff --git a/groups/unix-hdev-01/data.tf b/groups/unix-hdev-01/data.tf index ad1ad5d..f8ccf38 100644 --- a/groups/unix-hdev-01/data.tf +++ b/groups/unix-hdev-01/data.tf @@ -121,3 +121,7 @@ data "aws_security_group" "unix_development_01_sg" { data "vault_generic_secret" "chs_subnet" { path = "aws-accounts/network/${var.aws_account}/chs/application-subnets" } + +data "vault_generic_secret" "sns_url" { + path = "applications/${var.aws_account}-${var.aws_region}/monitoring" +} \ No newline at end of file diff --git a/groups/unix-hdev-01/sns.tf b/groups/unix-hdev-01/sns.tf index 5590db9..3604388 100644 --- a/groups/unix-hdev-01/sns.tf +++ b/groups/unix-hdev-01/sns.tf @@ -30,4 +30,30 @@ module "cloudwatch_sns_notifications_ooh" { "ServiceTeam", "UNIX" ) ) +} + + +resource "aws_sns_topic" "unix-dev-01_topic" { + name = "unix-dev-01_topic" +} + +resource "aws_sns_topic_subscription" "unix-dev-01_Subscription" { + topic_arn = aws_sns_topic.unix-dev-01_topic.arn + for_each = toset(["linuxsupport@companieshouse.gov.uk"]) + protocol = "email" + endpoint = each.value + + depends_on = [ + aws_sns_topic.unix-dev-01_topic + ] +} + +resource "aws_sns_topic_subscription" "unix-dev-01_Subscriptionhttps" { + topic_arn = aws_sns_topic.unix-dev-01_topic.arn + protocol = "https" + endpoint = data.vault_generic_secret.sns_url.data["url"] + + depends_on = [ + aws_sns_topic.unix-dev-01_topic + ] } \ No newline at end of file