Skip to content

Commit 3b2b5d0

Browse files
authored
adding the functionality to attach a SQS as Dead Letter Queue to Lambda function (#23)
1 parent 52f1651 commit 3b2b5d0

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This module will deploy a Lambda function. It supports both Zip and Image deploy
2525
- `use_default_security_group` - (bool) - Use the default security group for the Lambda function.
2626
- `vpc_id` - (string) - The VPC ID in which the Lambda runs.
2727
- `tracing_mode` - (string) - Tracing mode for the Lambda. Valid options: PassThrough (default) and Active.
28+
- `dead_letter_queue_arn` - (string)- The ARN of the dead letter queue for the Lambda function.
2829

2930
### Zip deployment variables
3031
- `runtime` - (string) - **REQUIRED** - The runtime environment for the Lambda function you are uploading.

main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ resource "aws_lambda_function" "lambda_function" {
7777
tracing_config {
7878
mode = var.tracing_mode
7979
}
80+
81+
dynamic "dead_letter_config" {
82+
for_each = var.dead_letter_queue_arn != "" ? [1] : []
83+
content {
84+
target_arn = var.dead_letter_queue_arn
85+
}
86+
}
8087
}
8188

8289
resource "aws_cloudwatch_log_group" "lambda_loggroup" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ variable "image_config_entry_point" {
1616
default = []
1717
}
1818

19+
variable "dead_letter_queue_arn" {
20+
type = string
21+
description = "The ARN of the dead letter queue for the Lambda function."
22+
default = ""
23+
}
24+
1925
variable "image_config_working_directory" {
2026
type = string
2127
description = "Optional override of image's WORKDIR"

0 commit comments

Comments
 (0)