diff --git a/infrastructure/terraform/modules/sqs/README.md b/infrastructure/terraform/modules/sqs/README.md index 7510278d..6a3b94b2 100644 --- a/infrastructure/terraform/modules/sqs/README.md +++ b/infrastructure/terraform/modules/sqs/README.md @@ -26,6 +26,7 @@ | [enable\_queue\_oldest\_message\_alarm](#input\_enable\_queue\_oldest\_message\_alarm) | Create a CloudWatch alarm when the oldest visible message age breaches the configured threshold on the main queue | `bool` | `true` | 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) | Enable high throughput mode for FIFO queues. Limits deduplication scope to message group. | `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 | diff --git a/infrastructure/terraform/modules/sqs/sqs_queue.tf b/infrastructure/terraform/modules/sqs/sqs_queue.tf index 35537257..2001607a 100644 --- a/infrastructure/terraform/modules/sqs/sqs_queue.tf +++ b/infrastructure/terraform/modules/sqs/sqs_queue.tf @@ -6,6 +6,8 @@ resource "aws_sqs_queue" "sqs_queue" { delay_seconds = var.delay_seconds fifo_queue = var.fifo_queue content_based_deduplication = var.content_based_deduplication + deduplication_scope = var.fifo_queue && var.high_throughput_fifo ? "messageGroup" : null + fifo_throughput_limit = var.fifo_queue && var.high_throughput_fifo ? "perMessageGroupId" : null max_message_size = var.max_message_size kms_master_key_id = var.sqs_kms_key_arn diff --git a/infrastructure/terraform/modules/sqs/sqs_queue_deadletter_queue.tf b/infrastructure/terraform/modules/sqs/sqs_queue_deadletter_queue.tf index be9f9e92..556ae0a0 100644 --- a/infrastructure/terraform/modules/sqs/sqs_queue_deadletter_queue.tf +++ b/infrastructure/terraform/modules/sqs/sqs_queue_deadletter_queue.tf @@ -7,6 +7,8 @@ resource "aws_sqs_queue" "deadletter_queue" { visibility_timeout_seconds = var.visibility_timeout_seconds fifo_queue = var.fifo_queue content_based_deduplication = var.content_based_deduplication + deduplication_scope = var.fifo_queue && var.high_throughput_fifo ? "messageGroup" : null + fifo_throughput_limit = var.fifo_queue && var.high_throughput_fifo ? "perMessageGroupId" : null max_message_size = var.max_message_size kms_master_key_id = var.sqs_kms_key_arn diff --git a/infrastructure/terraform/modules/sqs/variables.tf b/infrastructure/terraform/modules/sqs/variables.tf index 8cfa8bc4..6e14946c 100644 --- a/infrastructure/terraform/modules/sqs/variables.tf +++ b/infrastructure/terraform/modules/sqs/variables.tf @@ -99,6 +99,12 @@ variable "content_based_deduplication" { default = false } +variable "high_throughput_fifo" { + description = "Enable high throughput mode for FIFO queues. Limits deduplication scope to message group." + type = bool + default = false +} + variable "kms_data_key_reuse_period_seconds" { description = "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)" type = number