From f5d516d838f08b855f43ff3307bcc24a5a698388 Mon Sep 17 00:00:00 2001 From: Buckingham Date: Wed, 23 Oct 2024 13:46:33 +0100 Subject: [PATCH 1/2] Update_231024_8 --- terraform/environments/ppud/sns.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/environments/ppud/sns.tf b/terraform/environments/ppud/sns.tf index 4d924c4158b..5d3273dd63f 100644 --- a/terraform/environments/ppud/sns.tf +++ b/terraform/environments/ppud/sns.tf @@ -104,7 +104,7 @@ resource "aws_sns_topic_policy" "s3_bucket_notifications_uat_policy" { "Service" : "s3.amazonaws.com" }, "Action" : "SNS:Publish", - "Resource" : "aws_sns_topic.s3_bucket_notifications_uat[0].arn", + "Resource" : "arn:aws:sns:eu-west-2:172753231260:s3_bucket_notifications_uat", "Condition" : { "ArnLike" : { "aws:SourceArn" : "arn:aws:s3:::moj-log-files-uat" From a697d1b72d5b6d75d0e5028bd1485ac9a405acf7 Mon Sep 17 00:00:00 2001 From: Buckingham Date: Wed, 23 Oct 2024 14:13:40 +0100 Subject: [PATCH 2/2] Update_231024_9 --- terraform/environments/ppud/sns.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/terraform/environments/ppud/sns.tf b/terraform/environments/ppud/sns.tf index 5d3273dd63f..027f8326769 100644 --- a/terraform/environments/ppud/sns.tf +++ b/terraform/environments/ppud/sns.tf @@ -81,6 +81,11 @@ resource "aws_sns_topic" "s3_bucket_notifications_uat" { name = "s3_bucket_notifications_uat" } +data "aws_sns_topic" "s3_bucket_notifications_uat" { + count = local.is-preproduction == true ? 1 : 0 + name = "s3_bucket_notifications_uat" +} + resource "aws_sns_topic_subscription" "s3_bucket_notifications_uat_subscription" { count = local.is-preproduction == true ? 1 : 0 topic_arn = aws_sns_topic.s3_bucket_notifications_uat[0].arn @@ -104,7 +109,7 @@ resource "aws_sns_topic_policy" "s3_bucket_notifications_uat_policy" { "Service" : "s3.amazonaws.com" }, "Action" : "SNS:Publish", - "Resource" : "arn:aws:sns:eu-west-2:172753231260:s3_bucket_notifications_uat", + "Resource" : "data.aws_sns_topic.s3_bucket_notifications_uat.arn", "Condition" : { "ArnLike" : { "aws:SourceArn" : "arn:aws:s3:::moj-log-files-uat"