Skip to content

Instantly share code, notes, and snippets.

@spy86
Created December 7, 2018 21:05
Show Gist options
  • Save spy86/e3f9c0a81c9deb7ca5a6b364e828071d to your computer and use it in GitHub Desktop.
Save spy86/e3f9c0a81c9deb7ca5a6b364e828071d to your computer and use it in GitHub Desktop.
resource "aws_cloudwatch_event_rule" "codepipeline" {
name = "CodePipelineExecutionStateChane"
description = "CodePipeline Pipeline Execution State Change"
event_pattern = << PATTERN
{
"source": [
"aws.codepipeline"
],
"detail-type": [
"CodePipeline Pipeline Execution State Change"
]
}
PATTERN
}
resource "aws_cloudwatch_event_target" "codepipeline_to_sns" {
rule = "$ {aws_cloudwatch_event_rule.codepipeline.name}"
arn = "$ {aws_sns_topic.codepipeline.arn}"
input_transformer {
input_paths = {
PipelineName = "$ .detail.pipeline"
State = "$ .detail.state"
}
input_template = "\" Pipeline [<PipelineName>] execution state changed [<State>] \ ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment