From 755f96cdf86997a1a90512c219c29344ce9f3308 Mon Sep 17 00:00:00 2001 From: Stephen Astels Date: Tue, 16 Apr 2024 15:16:39 -0400 Subject: [PATCH] always create receipt log groups --- aws/common/cloudwatch_log.tf | 5 ++--- aws/common/iam.tf | 4 ++-- aws/common/outputs.tf | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/aws/common/cloudwatch_log.tf b/aws/common/cloudwatch_log.tf index 0ca35220d..17350dad0 100644 --- a/aws/common/cloudwatch_log.tf +++ b/aws/common/cloudwatch_log.tf @@ -44,9 +44,8 @@ resource "aws_cloudwatch_log_group" "sns_deliveries_failures_us_west_2" { } } -# We probably always want these log groups as well as the sns ones... Pinpoint / SNS will write to them regardless -\_(ツ)_/- +# Pinpoint will log delivery receipts here, so it needs to be created resource "aws_cloudwatch_log_group" "pinpoint_deliveries" { - count = var.cloudwatch_enabled ? 1 : 1 name = "sns/${var.region}/${var.account_id}/PinPointDirectPublishToPhoneNumber" retention_in_days = var.sensitive_log_retention_period_days tags = { @@ -54,8 +53,8 @@ resource "aws_cloudwatch_log_group" "pinpoint_deliveries" { } } +# Pinpoint will log delivery receipts here, so it needs to be created resource "aws_cloudwatch_log_group" "pinpoint_deliveries_failures" { - count = var.cloudwatch_enabled ? 1 : 1 name = "sns/${var.region}/${var.account_id}/PinPointDirectPublishToPhoneNumber/Failure" retention_in_days = var.sensitive_log_retention_period_days tags = { diff --git a/aws/common/iam.tf b/aws/common/iam.tf index 9d6969b5f..f080b8a34 100644 --- a/aws/common/iam.tf +++ b/aws/common/iam.tf @@ -241,8 +241,8 @@ data "aws_iam_policy_document" "pinpoint_logs" { "logs:PutLogEvents" ] resources = [ - "${aws_cloudwatch_log_group.pinpoint_deliveries[0].arn}:*", - "${aws_cloudwatch_log_group.pinpoint_deliveries_failures[0].arn}:*" + "${aws_cloudwatch_log_group.pinpoint_deliveries.arn}:*", + "${aws_cloudwatch_log_group.pinpoint_deliveries_failures.arn}:*" ] } } diff --git a/aws/common/outputs.tf b/aws/common/outputs.tf index 7b11e881f..6b6f4e68d 100644 --- a/aws/common/outputs.tf +++ b/aws/common/outputs.tf @@ -144,19 +144,19 @@ output "sns_deliveries_failures_us_west_2_name" { } output "pinpoint_deliveries_ca_central_arn" { - value = var.cloudwatch_enabled ? aws_cloudwatch_log_group.pinpoint_deliveries[0].arn : "" + value = aws_cloudwatch_log_group.pinpoint_deliveries.arn } output "pinpoint_deliveries_ca_central_name" { - value = var.cloudwatch_enabled ? aws_cloudwatch_log_group.pinpoint_deliveries[0].name : "" + value = aws_cloudwatch_log_group.pinpoint_deliveries.name } output "pinpoint_deliveries_failures_ca_central_arn" { - value = var.cloudwatch_enabled ? aws_cloudwatch_log_group.pinpoint_deliveries_failures[0].arn : "" + value = aws_cloudwatch_log_group.pinpoint_deliveries_failures.arn } output "pinpoint_deliveries_failures_ca_central_name" { - value = var.cloudwatch_enabled ? aws_cloudwatch_log_group.pinpoint_deliveries_failures[0].name : "" + value = aws_cloudwatch_log_group.pinpoint_deliveries_failures.name } output "sqs_notify_internal_tasks_arn" {