-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsns.tf
48 lines (43 loc) · 1.11 KB
/
sns.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
44
45
46
47
48
data "aws_iam_policy_document" "sns_for_github" {
statement {
sid = "AllowListDescribe"
effect = "Allow"
actions = [
"sns:ListPlatformApplications",
"sns:ListSubscriptions",
"sns:ListTagsForResource",
"sns:ListTopics"
]
resources = ["*"]
}
statement {
sid = "AllowPublishOwn"
effect = "Allow"
actions = [
"sns:Publish",
"sns:GetPlatformApplicationAttributes",
"sns:GetSubscriptionAttributes",
"sns:GetTopicAttributes",
"sns:GetEndpointAttributes",
"sns:GetSubscriptionAttributes",
"sns:Publish"
]
resources = ["*"]
condition {
test = "StringLike"
variable = "aws:PrincipalTag/GithubTeam"
values = ["*:$${aws:ResourceTag/GithubTeam}:*"]
}
}
}
resource "aws_iam_policy" "sns_for_github" {
policy = data.aws_iam_policy_document.sns_for_github.json
name = "sns-for-github"
tags = {
GithubTeam = "webops"
}
}
resource "aws_iam_role_policy_attachment" "sns_for_github" {
role = aws_iam_role.github_access.name
policy_arn = aws_iam_policy.sns_for_github.arn
}