github.com/andresvia/terraform@v0.6.15-0.20160412045437-d51c75946785/website/source/docs/providers/aws/r/cloudwatch_event_target.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_cloudwatch_event_target" 4 sidebar_current: "docs-aws-resource-cloudwatch-event-target" 5 description: |- 6 Provides a CloudWatch Event Target resource. 7 --- 8 9 # aws\_cloudwatch\_event\_target 10 11 Provides a CloudWatch Event Target resource. 12 13 ## Example Usage 14 15 ``` 16 resource "aws_cloudwatch_event_target" "yada" { 17 target_id = "Yada" 18 rule = "${aws_cloudwatch_event_rule.console.name}" 19 arn = "${aws_kinesis_stream.test_stream.arn}" 20 } 21 22 resource "aws_cloudwatch_event_rule" "console" { 23 name = "capture-ec2-scaling-events" 24 description = "Capture all EC2 scaling events" 25 event_pattern = <<PATTERN 26 { 27 "source": [ 28 "aws.autoscaling" 29 ], 30 "detail-type": [ 31 "EC2 Instance Launch Successful", 32 "EC2 Instance Terminate Successful", 33 "EC2 Instance Launch Unsuccessful", 34 "EC2 Instance Terminate Unsuccessful" 35 ] 36 } 37 PATTERN 38 } 39 40 resource "aws_kinesis_stream" "test_stream" { 41 name = "terraform-kinesis-test" 42 shard_count = 1 43 } 44 ``` 45 46 ## Argument Reference 47 48 -> **Note:** `input` and `input_path` are mutually exclusive options. 49 -> **Note:** In order to be able to have your AWS Lambda function or 50 SNS topic invoked by a CloudWatch Events rule, you must setup the right permissions 51 using [`aws_lambda_permission`](https://www.terraform.io/docs/providers/aws/r/lambda_permission.html) 52 or [`aws_sns_topic.policy`](https://www.terraform.io/docs/providers/aws/r/sns_topic.html#policy). 53 More info here [here](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/EventsResourceBasedPermissions.html). 54 55 The following arguments are supported: 56 57 * `rule` - (Required) The name of the rule you want to add targets to. 58 * `target_id` - (Optional) The unique target assignment ID. If missing, will generate a random, unique id. 59 * `arn` - (Required) The Amazon Resource Name (ARN) associated of the target. 60 * `input` - (Optional) Valid JSON text passed to the target. 61 * `input_path` - (Optional) The value of the [JSONPath](http://goessner.net/articles/JsonPath/) 62 that is used for extracting part of the matched event when passing it to the target.