Skip to content

Commit f652f8d

Browse files
committed
githubwebhooks: allow infosec-prod account to access unfiltered GitHub stream
This was requested by @gene1wood so infosec can monitor GitHub activity.
1 parent 7ccbca9 commit f652f8d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

githubwebhooks/iam-roles.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,22 @@ resource "aws_iam_role_policy" "lambda_github_webhooks_pulse" {
146146
role = "${aws_iam_role.lambda_github_webhooks_pulse.id}"
147147
policy = "${data.aws_iam_policy_document.lambda_github_webhooks_pulse.json}"
148148
}
149+
150+
data "aws_iam_policy_document" "sns_webhooks_all" {
151+
# Grant access to infosec-prod account.
152+
statement = {
153+
sid = "github_webhooks_all_infosec_subscribe"
154+
effect = "Allow"
155+
actions = [
156+
"SNS:ListSubscriptionsByTopic",
157+
"SNS:Subscribe",
158+
]
159+
resources = [
160+
"${aws_sns_topic.webhooks_all.arn}",
161+
]
162+
principals {
163+
type = "AWS"
164+
identifiers = ["371522382791"]
165+
}
166+
}
167+
}

githubwebhooks/sns.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ resource "aws_sns_topic" "webhooks_all" {
22
name = "github-webhooks-all"
33
}
44

5+
resource "aws_sns_topic_policy" "webhooks_all" {
6+
arn = "${aws_sns_topic.webhooks_all.arn}"
7+
policy = "${data.aws_iam_policy_document.sns_webhooks_all.json}"
8+
}
9+
510
resource "aws_sns_topic" "webhooks_public" {
611
name = "github-webhooks-public"
712
}

0 commit comments

Comments
 (0)