-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
43 lines (36 loc) · 2.1 KB
/
main.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
module "queue" {
source = "justtrackio/sqs-queue/aws"
version = "1.5.1"
for_each = var.queues
context = module.this.context
alarm_enabled = each.value.alarm.enabled
alarm_minutes = each.value.alarm.backlog_minutes
alarm_period = each.value.alarm.period
alarm_evaluation_periods = each.value.alarm.evaluation_periods
alarm_datapoints_to_alarm = each.value.alarm.datapoints_to_alarm
alarm_description = each.value.alarm.description
alarm_threshold = each.value.alarm.threshold
alarm_topic_arn = var.alarm_topic_arn
aws_account_id = module.this.aws_account_id
aws_region = module.this.aws_region
dead_letter_queue_arn = try(each.value.queue.dead_letter_queue_create, true) ? module.dead[each.key].queue_arn : null
delay_seconds = each.value.queue.delay_seconds
fifo_queue = each.value.queue.fifo_queue
max_receive_count = each.value.queue.max_receive_count
message_retention_seconds = each.value.queue.message_retention_seconds
principals_with_send_permission = each.value.queue.principals_with_send_permission
queue_name = try(each.value.queue.fifo_queue, false) ? "${each.key}.fifo" : each.key
source_arns = [for k, v in each.value.subscriptions != null ? each.value.subscriptions : {} : v.topic_arn]
visibility_timeout_seconds = each.value.queue.visibility_timeout_seconds
}
module "dead" {
source = "justtrackio/sqs-queue/aws"
version = "1.5.1"
for_each = { for k, v in var.queues : k => v if v.queue.dead_letter_queue_create }
context = module.this.context
aws_region = module.this.aws_region
aws_account_id = module.this.aws_account_id
fifo_queue = each.value.queue.fifo_queue
message_retention_seconds = each.value.queue.message_retention_seconds
queue_name = try(each.value.queue.fifo_queue, false) ? "${each.key}-dead.fifo" : "${each.key}-dead"
}