github.com/emc-cmd/terraform@v0.7.8-0.20161101145618-f16309630e7c/examples/aws-cloudwatch-events/sns/main.tf (about) 1 provider "aws" { 2 region = "${var.aws_region}" 3 } 4 5 resource "aws_cloudwatch_event_rule" "foo" { 6 name = "${var.rule_name}" 7 8 event_pattern = <<PATTERN 9 { 10 "detail-type": [ 11 "AWS API Call via CloudTrail" 12 ], 13 "detail": { 14 "eventSource": [ 15 "cloudtrail.amazonaws.com" 16 ] 17 } 18 } 19 PATTERN 20 } 21 22 resource "aws_cloudwatch_event_target" "bar" { 23 rule = "${aws_cloudwatch_event_rule.foo.name}" 24 target_id = "${var.target_name}" 25 arn = "${aws_sns_topic.foo.arn}" 26 } 27 28 resource "aws_sns_topic" "foo" { 29 name = "${var.sns_topic_name}" 30 }