Skip to content

Instantly share code, notes, and snippets.

@spy86
Created December 7, 2018 21:03
Show Gist options
  • Save spy86/b2cd13c8de309b261b5aa39da39bc1b1 to your computer and use it in GitHub Desktop.
Save spy86/b2cd13c8de309b261b5aa39da39bc1b1 to your computer and use it in GitHub Desktop.
resource "aws_sns_topic" "codepipeline" {
name = "CodePipelineExecutionStateChange"
}
resource "aws_sns_topic_policy" "codepipeline" {
arn = "$ {aws_sns_topic.codepipeline.arn}"
policy = "$ {data.aws_iam_policy_document.sns_topic_policy.json}"
}
data "aws_iam_policy_document" "sns_topic_policy" {
statement {
effect = "Allow"
actions = ["sns: publish"]
principals {
type = "Service"
identifiers = ["events.amazonaws.com"]
}
resources = ["$ {aws_sns_topic.codepipeline.arn}"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment