diff --git a/infrastructure/modules/sqs/README.md b/infrastructure/modules/sqs/README.md index 66fdead..12a2f40 100644 --- a/infrastructure/modules/sqs/README.md +++ b/infrastructure/modules/sqs/README.md @@ -23,6 +23,7 @@ | [fifo\_queue](#input\_fifo\_queue) | Boolean designating a FIFO queue | `bool` | `false` | no | | [kms\_data\_key\_reuse\_period\_seconds](#input\_kms\_data\_key\_reuse\_period\_seconds) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours) | `number` | `300` | no | | [max\_message\_size](#input\_max\_message\_size) | The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB) | `number` | `262144` | no | +| [max\_receive\_count](#input\_max\_receive\_count) | The maximum number of times a message can be received before being sent to the DLQ | `number` | `3` | no | | [message\_retention\_seconds](#input\_message\_retention\_seconds) | The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days) | `number` | `null` | no | | [name](#input\_name) | Name of the SQS Queue | `string` | n/a | yes | | [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes | diff --git a/infrastructure/modules/sqs/sqs_queue_redrive_policy.tf b/infrastructure/modules/sqs/sqs_queue_redrive_policy.tf index 1df9ed2..2169dcf 100644 --- a/infrastructure/modules/sqs/sqs_queue_redrive_policy.tf +++ b/infrastructure/modules/sqs/sqs_queue_redrive_policy.tf @@ -4,6 +4,6 @@ resource "aws_sqs_queue_redrive_policy" "redrive_policy" { queue_url = aws_sqs_queue.sqs_queue.url redrive_policy = jsonencode({ deadLetterTargetArn = aws_sqs_queue.deadletter_queue[0].arn - maxReceiveCount = 3 + maxReceiveCount = var.max_receive_count }) } diff --git a/infrastructure/modules/sqs/variables.tf b/infrastructure/modules/sqs/variables.tf index 18fe88a..f7ca0f6 100644 --- a/infrastructure/modules/sqs/variables.tf +++ b/infrastructure/modules/sqs/variables.tf @@ -116,3 +116,9 @@ variable "create_dlq" { type = bool default = false } + +variable "max_receive_count" { + description = "The maximum number of times a message can be received before being sent to the DLQ" + type = number + default = 3 +}