Skip to content

Commit a16fad2

Browse files
committed
CCM-7939: consolidate to single high throughput variable
1 parent 8410ca1 commit a16fad2

3 files changed

Lines changed: 9 additions & 19 deletions

File tree

infrastructure/modules/sqs/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
| <a name="input_component"></a> [component](#input\_component) | The name of the tfscaffold component | `string` | n/a | yes |
1717
| <a name="input_content_based_deduplication"></a> [content\_based\_deduplication](#input\_content\_based\_deduplication) | Enables content-based deduplication for FIFO queues | `bool` | `false` | no |
1818
| <a name="input_create_dlq"></a> [create\_dlq](#input\_create\_dlq) | Create a DLQ | `bool` | `false` | no |
19-
| <a name="input_deduplication_scope"></a> [deduplication\_scope](#input\_deduplication\_scope) | For FIFO queues, specifies whether message deduplication occurs at the message group or queue level. Valid values are messageGroup and queue (default). | `string` | `"queue"` | no |
2019
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | A map of default tags to apply to all taggable resources within the component | `map(string)` | `{}` | no |
2120
| <a name="input_delay_seconds"></a> [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 |
2221
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the tfscaffold environment | `string` | n/a | yes |
2322
| <a name="input_fifo_queue"></a> [fifo\_queue](#input\_fifo\_queue) | Boolean designating a FIFO queue | `bool` | `false` | no |
24-
| <a name="input_fifo_throughput_limit"></a> [fifo\_throughput\_limit](#input\_fifo\_throughput\_limit) | For FIFO queues, specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are perQueue (default) and perMessageGroupId. | `string` | `"perQueue"` | no |
23+
| <a name="input_high_throughput_fifo"></a> [high\_throughput\_fifo](#input\_high\_throughput\_fifo) | For FIFO queues, specifies whether high throughput mode is enabled. | `bool` | `false` | no |
2524
| <a name="input_kms_data_key_reuse_period_seconds"></a> [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 |
2625
| <a name="input_max_message_size"></a> [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 |
2726
| <a name="input_message_retention_seconds"></a> [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 |

infrastructure/modules/sqs/sqs_queue.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ resource "aws_sqs_queue" "sqs_queue" {
77
fifo_queue = var.fifo_queue
88
content_based_deduplication = var.content_based_deduplication
99
max_message_size = var.max_message_size
10-
deduplication_scope = var.fifo_queue ? var.deduplication_scope : null
11-
fifo_throughput_limit = var.fifo_queue ? var.fifo_throughput_limit : null
10+
deduplication_scope = (var.fifo_queue && var.high_throughput_fifo) ? "messageGroup" : null
11+
fifo_throughput_limit = (var.fifo_queue && var.high_throughput_fifo) ? "perMessageGroupId" : null
1212

1313
kms_master_key_id = var.sqs_kms_key_arn
1414
kms_data_key_reuse_period_seconds = var.kms_data_key_reuse_period_seconds

infrastructure/modules/sqs/variables.tf

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,14 @@ variable "create_dlq" {
111111
default = false
112112
}
113113

114-
variable "deduplication_scope" {
115-
description = "For FIFO queues, specifies whether message deduplication occurs at the message group or queue level. Valid values are messageGroup and queue (default)."
116-
type = string
117-
default = "queue"
114+
variable "high_throughput_fifo" {
115+
description = "For FIFO queues, specifies whether high throughput mode is enabled."
116+
type = bool
117+
default = false
118118

119119
validation {
120-
condition = contains([], var.deduplication_scope)
121-
error_message = "deduplication_scope must be either \"queue\" or \"messageGroup\""
120+
condition = var.high_throughput_fifo == false || var.fifo_queue == true
121+
error_message = "high_throughput_fifo can only be true if fifo_queue is also true"
122122
}
123123
}
124-
variable "fifo_throughput_limit" {
125-
description = "For FIFO queues, specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are perQueue (default) and perMessageGroupId."
126-
type = string
127-
default = "perQueue"
128124

129-
validation {
130-
condition = contains([], var.fifo_throughput_limit)
131-
error_message = "fifo_throughput_limit must be either \"perQueue\" or \"perMessageGroup\""
132-
}
133-
}

0 commit comments

Comments
 (0)