generated from production-ready-toolkit/terraform-module-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sqs.tf
46 lines (34 loc) · 1.83 KB
/
sqs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
resource "aws_sqs_queue" "main" {
name = format("%s%s", var.name, var.fifo ? ".fifo" : "")
max_message_size = var.max_message_size
visibility_timeout_seconds = var.visibility_timeout
message_retention_seconds = var.expiration_time_seconds
receive_wait_time_seconds = var.receive_wait_time_seconds
delay_seconds = var.delay
kms_master_key_id = var.kms_key != "" ? var.kms_key : aws_kms_key.main[0].arn
kms_data_key_reuse_period_seconds = var.kms_cache_time
fifo_queue = var.fifo
content_based_deduplication = var.fifo
deduplication_scope = var.fifo ? var.fifo_deduplication_scope : null
fifo_throughput_limit = var.fifo ? var.fifo_throughput_limit : null
redrive_policy = jsonencode({
deadLetterTargetArn = aws_sqs_queue.dlq.arn
maxReceiveCount = var.max_retry
})
tags = var.tags
}
resource "aws_sqs_queue" "dlq" {
name = format("%s-dlq%s", var.name, var.fifo ? ".fifo" : "")
max_message_size = var.max_message_size
visibility_timeout_seconds = var.visibility_timeout_dlq
message_retention_seconds = var.expiration_time_seconds_dlq
receive_wait_time_seconds = var.receive_wait_time_seconds_dlq
delay_seconds = var.delay_dlq
kms_master_key_id = var.kms_key != "" ? var.kms_key : aws_kms_key.main[0].arn
kms_data_key_reuse_period_seconds = var.kms_cache_time
fifo_queue = var.fifo
content_based_deduplication = var.fifo
deduplication_scope = var.fifo ? var.fifo_deduplication_scope : null
fifo_throughput_limit = var.fifo ? var.fifo_throughput_limit : null
tags = var.tags
}