github.com/adrian-bl/terraform@v0.7.0-rc2.0.20160705220747-de0a34fc3517/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 event_pattern = <<PATTERN 8 { 9 "detail-type": [ 10 "AWS API Call via CloudTrail" 11 ], 12 "detail": { 13 "eventSource": [ 14 "cloudtrail.amazonaws.com" 15 ] 16 } 17 } 18 PATTERN 19 } 20 21 resource "aws_cloudwatch_event_target" "bar" { 22 rule = "${aws_cloudwatch_event_rule.foo.name}" 23 target_id = "${var.target_name}" 24 arn = "${aws_sns_topic.foo.arn}" 25 } 26 27 resource "aws_sns_topic" "foo" { 28 name = "${var.sns_topic_name}" 29 }