-
-
Notifications
You must be signed in to change notification settings - Fork 343
/
iam.tf
38 lines (31 loc) · 1.06 KB
/
iam.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
locals {
create_sns_feedback_role = local.create && var.create_sns_topic && var.enable_sns_topic_delivery_status_logs && var.sns_topic_lambda_feedback_role_arn == ""
}
data "aws_iam_policy_document" "sns_feedback" {
count = local.create_sns_feedback_role ? 1 : 0
statement {
sid = "SnsAssume"
effect = "Allow"
actions = [
"sts:AssumeRole",
"sts:TagSession",
]
principals {
type = "Service"
identifiers = ["sns.amazonaws.com"]
}
}
}
resource "aws_iam_role" "sns_feedback_role" {
count = local.create_sns_feedback_role ? 1 : 0
name = var.sns_topic_feedback_role_name
description = var.sns_topic_feedback_role_description
path = var.sns_topic_feedback_role_path
force_detach_policies = var.sns_topic_feedback_role_force_detach_policies
permissions_boundary = var.sns_topic_feedback_role_permissions_boundary
assume_role_policy = data.aws_iam_policy_document.sns_feedback[0].json
tags = merge(
var.tags,
var.sns_topic_feedback_role_tags,
)
}