Skip to content

Commit

Permalink
always create receipt log groups
Browse files Browse the repository at this point in the history
  • Loading branch information
sastels committed Apr 16, 2024
1 parent 7c3c352 commit 68d1be5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions aws/common/cloudwatch_log.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@ 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 = {
CostCenter = "notification-canada-ca-${var.env}"
}
}

Check failure

Code scanning / checkov

Ensure that CloudWatch Log Group is encrypted by KMS Error

Ensure that CloudWatch Log Group is encrypted by KMS

# 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 = {
Expand Down
4 changes: 2 additions & 2 deletions aws/common/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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}:*"
]
}
}
8 changes: 4 additions & 4 deletions aws/common/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = var.cloudwatch_enabled ? 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 = var.cloudwatch_enabled ? 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 = var.cloudwatch_enabled ? aws_cloudwatch_log_group.pinpoint_deliveries_failure.arn : ""
}

output "pinpoint_deliveries_failures_ca_central_name" {
value = var.cloudwatch_enabled ? aws_cloudwatch_log_group.pinpoint_deliveries_failures[0].name : ""
value = var.cloudwatch_enabled ? aws_cloudwatch_log_group.pinpoint_deliveries_failures.name : ""
}

output "sqs_notify_internal_tasks_arn" {
Expand Down

0 comments on commit 68d1be5

Please sign in to comment.