Skip to content

Commit 488172f

Browse files
committed
Logging fixes
1 parent 379ef80 commit 488172f

5 files changed

Lines changed: 26 additions & 2 deletions

File tree

infrastructure/terraform/components/api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ No requirements.
3737
| <a name="input_project"></a> [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes |
3838
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |
3939
| <a name="input_shared_infra_account_id"></a> [shared\_infra\_account\_id](#input\_shared\_infra\_account\_id) | The AWS Account ID of the shared infrastructure account | `string` | `"000000000000"` | no |
40-
| <a name="input_sns_success_logging_sample_percent"></a> [sns\_success\_logging\_sample\_percent](#input\_sns\_success\_logging\_sample\_percent) | Enable SNS Delivery Successful Sample Percentage | `number` | `0` | no |
40+
| <a name="input_sns_success_logging_sample_percent"></a> [sns\_success\_logging\_sample\_percent](#input\_sns\_success\_logging\_sample\_percent) | Enable SNS Delivery Successful Sample Percentage | `number` | `100` | no |
4141
## Modules
4242

4343
| Name | Source | Version |

infrastructure/terraform/components/api/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ variable "enable_sns_delivery_logging" {
179179
variable "sns_success_logging_sample_percent" {
180180
type = number
181181
description = "Enable SNS Delivery Successful Sample Percentage"
182-
default = 0
182+
default = 100
183183
}
184184

185185
variable "enable_api_data_trace" {

infrastructure/terraform/modules/eventsub/cloudwatch_log_group_sns_delivery_logging_failure.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ resource "aws_cloudwatch_log_group" "sns_delivery_logging_failure" {
77
kms_key_id = var.kms_key_arn
88
retention_in_days = var.log_retention_in_days
99
}
10+
11+
resource "aws_cloudwatch_log_group" "amendments_sns_delivery_logging_failure" {
12+
count = var.enable_sns_delivery_logging ? 1 : 0
13+
14+
# SNS doesn't allow specifying a log group and is derived as: sns/${region}/${account_id}/${name_of_sns_topic}/Failure
15+
# (for failure logs)
16+
name = "sns/${var.region}/${var.aws_account_id}/${local.csi}/Failure"
17+
kms_key_id = var.kms_key_arn
18+
retention_in_days = var.log_retention_in_days
19+
}

infrastructure/terraform/modules/eventsub/cloudwatch_log_group_sns_delivery_logging_success.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ resource "aws_cloudwatch_log_group" "sns_delivery_logging_success" {
77
kms_key_id = var.kms_key_arn
88
retention_in_days = var.log_retention_in_days
99
}
10+
11+
resource "aws_cloudwatch_log_group" "amendments_sns_delivery_logging_success" {
12+
count = var.enable_sns_delivery_logging ? 1 : 0
13+
14+
# SNS doesn't allow specifying a log group and is derived as: sns/${region}/${account_id}/${name_of_sns_topic}
15+
# (for success logs)
16+
name = "sns/${var.region}/${var.aws_account_id}/${local.csi}"
17+
kms_key_id = var.kms_key_arn
18+
retention_in_days = var.log_retention_in_days
19+
}

infrastructure/terraform/modules/eventsub/iam_policy_sns_delivery_logging_cloudwatch.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ data "aws_iam_policy_document" "sns_delivery_logging_cloudwatch" {
3939
"${aws_cloudwatch_log_group.sns_delivery_logging_success[0].arn}:log-stream:*",
4040
aws_cloudwatch_log_group.sns_delivery_logging_failure[0].arn,
4141
"${aws_cloudwatch_log_group.sns_delivery_logging_failure[0].arn}:log-stream:*",
42+
aws_cloudwatch_log_group.amendments_sns_delivery_logging_success[0].arn,
43+
"${aws_cloudwatch_log_group.sns_delivery_logging_success[0].arn}:log-stream:*",
44+
aws_cloudwatch_log_group.amendments_sns_delivery_logging_failure[0].arn,
45+
"${aws_cloudwatch_log_group.sns_delivery_logging_failure[0].arn}:log-stream:*",
4246
]
4347
}
4448
}

0 commit comments

Comments
 (0)