diff --git a/infrastructure/modules/sqs/README.md b/infrastructure/modules/sqs/README.md index 23de60e..ecce6b5 100644 --- a/infrastructure/modules/sqs/README.md +++ b/infrastructure/modules/sqs/README.md @@ -20,6 +20,7 @@ | [delay\_seconds](#input\_delay\_seconds) | Time in seconds that the delivery of all messages in the queue will be delayed. An integer from 0 to 900 (15 minutes). | `number` | `0` | no | | [environment](#input\_environment) | The name of the tfscaffold environment | `string` | n/a | yes | | [fifo\_queue](#input\_fifo\_queue) | Boolean designating a FIFO queue | `bool` | `false` | no | +| [high\_throughput\_fifo](#input\_high\_throughput\_fifo) | For FIFO queues, specifies whether high throughput mode is enabled. | `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 | | [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 | diff --git a/infrastructure/modules/sqs/sqs_queue.tf b/infrastructure/modules/sqs/sqs_queue.tf index cd3446e..5635bb1 100644 --- a/infrastructure/modules/sqs/sqs_queue.tf +++ b/infrastructure/modules/sqs/sqs_queue.tf @@ -7,6 +7,8 @@ resource "aws_sqs_queue" "sqs_queue" { fifo_queue = var.fifo_queue content_based_deduplication = var.content_based_deduplication max_message_size = var.max_message_size + deduplication_scope = (var.fifo_queue && var.high_throughput_fifo) ? "messageGroup" : null + fifo_throughput_limit = (var.fifo_queue && var.high_throughput_fifo) ? "perMessageGroupId" : null kms_master_key_id = var.sqs_kms_key_arn kms_data_key_reuse_period_seconds = var.kms_data_key_reuse_period_seconds diff --git a/infrastructure/modules/sqs/variables.tf b/infrastructure/modules/sqs/variables.tf index b26ff39..99968b0 100644 --- a/infrastructure/modules/sqs/variables.tf +++ b/infrastructure/modules/sqs/variables.tf @@ -110,3 +110,15 @@ variable "create_dlq" { type = bool default = false } + +variable "high_throughput_fifo" { + description = "For FIFO queues, specifies whether high throughput mode is enabled." + type = bool + default = false + + validation { + condition = var.high_throughput_fifo == false || var.fifo_queue == true + error_message = "high_throughput_fifo can only be true if fifo_queue is also true" + } +} +