-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tf
30 lines (25 loc) · 832 Bytes
/
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
locals {
topics = flatten([
for topic in var.topics :
{
name = var.resource_prefix != "" ? "${var.resource_prefix}__${topic.name}" : topic.name
fifo_topic = topic.fifo_topic != null ? topic.fifo_topic : var.default_fifo_topic
content_based_deduplication = lookup(topic, "content_based_deduplication", false)
}
])
sns_topics = {
for topic in local.topics : topic.fifo_topic ? "${topic.name}.fifo" : topic.name => topic
}
}
resource "aws_sns_topic" "sns_topics" {
for_each = local.sns_topics
name = each.key
fifo_topic = each.value.fifo_topic
content_based_deduplication = each.value.content_based_deduplication
tags = var.default_tags
lifecycle {
ignore_changes = [
tags,
]
}
}