-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws_iam_policy_document.tf
41 lines (34 loc) · 1.07 KB
/
aws_iam_policy_document.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
locals {
actual_policy_documents = flatten([
for topic in var.raw_sns_topics : {
iam_policy_statements = topic.iam_policy_statements
suffix = topic.suffix
} if length(topic.iam_policy_statements) > 0
])
}
data "aws_iam_policy_document" "topic_policies" {
for_each = { for topic in local.actual_policy_documents : topic.suffix => topic }
dynamic "statement" {
for_each = each.value["iam_policy_statements"]
content {
sid = statement.value["sid"]
actions = statement.value["actions"]
resources = statement.value["resources"]
dynamic "principals" {
for_each = statement.value["principals"]
content {
type = principals.value["type"]
identifiers = principals.value["identifiers"]
}
}
dynamic "condition" {
for_each = statement.value["conditions"]
content {
test = condition.value["test"]
variable = condition.value["variable"]
values = condition.value["values"]
}
}
}
}
}