Skip to content

Commit d71e17d

Browse files
CCM-8569 adding DLQ
1 parent f897562 commit d71e17d

4 files changed

Lines changed: 23 additions & 12 deletions

File tree

infrastructure/modules/eventpub/iam_role_lambda.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ data "aws_iam_policy_document" "lambda" {
6767
]
6868
}
6969

70+
statement {
71+
sid = "DLQPutMessage"
72+
effect = "Allow"
73+
74+
actions = [
75+
"sqs:SendMessage",
76+
]
77+
78+
resources = [
79+
aws_sqs_queue.dlq.arn
80+
]
81+
}
82+
7083
statement {
7184
sid = "KMSCloudwatchKeyAccess"
7285
effect = "Allow"

infrastructure/modules/eventpub/lambda_function.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ resource "aws_lambda_function" "main" {
1313
source_code_hash = data.archive_file.lambda.output_base64sha256
1414

1515
logging_config {
16-
application_log_level = "INFO"
16+
application_log_level = var.log_level
1717
log_format = "JSON"
1818
log_group = aws_cloudwatch_log_group.lambda.name
19-
system_log_level = "WARN"
19+
system_log_level = var.log_level
2020
}
2121

2222
environment {
2323
variables = {
2424
DATA_PLANE_EVENT_BUS_ARN = var.data_plane_bus_arn
2525
CONTROL_PLANE_EVENT_BUS_ARN = var.control_plane_bus_arn
26+
DLQ_URL = aws_sqs_queue.dlq.url
27+
THROTTLE_DELAY_MS = "0"
2628
}
2729
}
2830
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "aws_sqs_queue" "dlq" {
2+
name = "${local.csi}-dlq"
3+
4+
kms_master_key_id = var.kms_key_arn
5+
}

infrastructure/modules/eventpub/variables.tf

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,7 @@ variable "enable_sns_delivery_logging" {
8383
default = false
8484
}
8585

86-
variable "sns_delivery_logging_bucket" {
87-
type = string
88-
description = "An S3 bucket name if event caching is enabled"
89-
default = ""
9086

91-
validation {
92-
condition = var.enable_sns_delivery_logging == false || length(var.sns_delivery_logging_bucket) > 1
93-
error_message = "If delivery logs are required, an S3 bucket name must be provided"
94-
}
95-
}
9687

9788
variable "sns_success_logging_sample_percent" {
9889
type = number
@@ -103,7 +94,7 @@ variable "sns_success_logging_sample_percent" {
10394
variable "log_level" {
10495
type = string
10596
description = "The log level to be used in lambda functions within the component. Any log with a lower severity than the configured value will not be logged: https://docs.python.org/3/library/logging.html#levels"
106-
default = "INFO"
97+
default = "WARN"
10798
}
10899

109100
variable "event_cache_expiry_days" {

0 commit comments

Comments
 (0)