-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsns_topic.tf
More file actions
36 lines (30 loc) · 784 Bytes
/
sns_topic.tf
File metadata and controls
36 lines (30 loc) · 784 Bytes
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
resource "aws_sns_topic" "main" {
name = "${local.csi}-test"
}
resource "aws_sns_topic_policy" "sns_publish" {
arn = aws_sns_topic.main.arn
policy = data.aws_iam_policy_document.sns_topic_policy_document.json
}
data "aws_iam_policy_document" "sns_topic_policy_document" {
statement {
sid = "AllowCrossDomainEventBridgeToPublishMessageToSNS"
effect = "Allow"
principals {
type = "AWS"
identifiers = [var.shared_infra_account_id]
}
actions = [
"sns:Publish",
]
resources = [
aws_sns_topic.main.arn,
]
condition {
test = "ArnLike"
variable = "aws:SourceArn"
values = [
"arn:aws:events:${var.region}:${var.shared_infra_account_id}:rule/*-data-plane*"
]
}
}
}