diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 093121e0..74f3751c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
- rev: v1.62.3
+ rev: v1.76.0
hooks:
- id: terraform_fmt
- id: terraform_validate
@@ -23,7 +23,7 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.1.0
+ rev: v4.3.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
diff --git a/README.md b/README.md
index bb2dbf9b..d532add7 100644
--- a/README.md
+++ b/README.md
@@ -106,6 +106,8 @@ See the [functions](https://github.com/terraform-aws-modules/terraform-aws-notif
| [iam\_role\_path](#input\_iam\_role\_path) | Path of IAM role to use for Lambda Function | `string` | `null` | no |
| [iam\_role\_tags](#input\_iam\_role\_tags) | Additional tags for the IAM role | `map(string)` | `{}` | no |
| [kms\_key\_arn](#input\_kms\_key\_arn) | ARN of the KMS key used for decrypting slack webhook url | `string` | `""` | no |
+| [lambda\_attach\_dead\_letter\_policy](#input\_lambda\_attach\_dead\_letter\_policy) | Controls whether SNS/SQS dead letter notification policy should be added to IAM role for Lambda Function | `bool` | `false` | no |
+| [lambda\_dead\_letter\_target\_arn](#input\_lambda\_dead\_letter\_target\_arn) | The ARN of an SNS topic or SQS queue to notify when an invocation fails. | `string` | `null` | no |
| [lambda\_description](#input\_lambda\_description) | The description of the Lambda function | `string` | `null` | no |
| [lambda\_function\_ephemeral\_storage\_size](#input\_lambda\_function\_ephemeral\_storage\_size) | Amount of ephemeral storage (/tmp) in MB your Lambda Function can use at runtime. Valid value between 512 MB to 10,240 MB (10 GB). | `number` | `512` | no |
| [lambda\_function\_name](#input\_lambda\_function\_name) | The name of the Lambda function to create | `string` | `"notify_slack"` | no |
diff --git a/main.tf b/main.tf
index 5a0075fe..a12efb90 100644
--- a/main.tf
+++ b/main.tf
@@ -118,6 +118,9 @@ module "lambda" {
use_existing_cloudwatch_log_group = true
attach_network_policy = var.lambda_function_vpc_subnet_ids != null
+ dead_letter_target_arn = var.lambda_dead_letter_target_arn
+ attach_dead_letter_policy = var.lambda_attach_dead_letter_policy
+
allowed_triggers = {
AllowExecutionFromSNS = {
principal = "sns.amazonaws.com"
diff --git a/variables.tf b/variables.tf
index 04bd7771..af5fa65e 100644
--- a/variables.tf
+++ b/variables.tf
@@ -34,6 +34,18 @@ variable "lambda_source_path" {
default = null
}
+variable "lambda_dead_letter_target_arn" {
+ description = "The ARN of an SNS topic or SQS queue to notify when an invocation fails."
+ type = string
+ default = null
+}
+
+variable "lambda_attach_dead_letter_policy" {
+ description = "Controls whether SNS/SQS dead letter notification policy should be added to IAM role for Lambda Function"
+ type = bool
+ default = false
+}
+
variable "sns_topic_name" {
description = "The name of the SNS topic to create"
type = string