Skip to content

Instantly share code, notes, and snippets.

@manavskohli
Last active February 14, 2019 18:41
Show Gist options
  • Save manavskohli/d89c16443c8749d3276295fc194cc2e7 to your computer and use it in GitHub Desktop.
Save manavskohli/d89c16443c8749d3276295fc194cc2e7 to your computer and use it in GitHub Desktop.
data "aws_iam_policy_document" "sns_policy" {
statement {
effect = "Allow"
principals {
identifiers = ["*"]
type = "AWS"
}
actions = [
"SNS:Publish"
]
resources = [
"arn:aws:sns:us-east-1:*:s3_fanout"
]
condition = {
test = "ArnLike"
variable = "aws:SourceArn"
values = [
"${aws_s3_bucket.source-bucket.arn}"
]
}
}
}
resource "aws_sns_topic" "s3_fanout" {
name = "s3_fanout"
policy = "${data.aws_iam_policy_document.sns_policy.json}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment