github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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 26 event_pattern = <<PATTERN 27 { 28 "source": [ 29 "aws.autoscaling" 30 ], 31 "detail-type": [ 32 "EC2 Instance Launch Successful", 33 "EC2 Instance Terminate Successful", 34 "EC2 Instance Launch Unsuccessful", 35 "EC2 Instance Terminate Unsuccessful" 36 ] 37 } 38 PATTERN 39 } 40 41 resource "aws_kinesis_stream" "test_stream" { 42 name = "terraform-kinesis-test" 43 shard_count = 1 44 } 45 ``` 46 47 ## Argument Reference 48 49 -> **Note:** `input` and `input_path` are mutually exclusive options. 50 -> **Note:** In order to be able to have your AWS Lambda function or 51 SNS topic invoked by a CloudWatch Events rule, you must setup the right permissions 52 using [`aws_lambda_permission`](https://www.terraform.io/docs/providers/aws/r/lambda_permission.html) 53 or [`aws_sns_topic.policy`](https://www.terraform.io/docs/providers/aws/r/sns_topic.html#policy). 54 More info here [here](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/EventsResourceBasedPermissions.html). 55 56 The following arguments are supported: 57 58 * `rule` - (Required) The name of the rule you want to add targets to. 59 * `target_id` - (Optional) The unique target assignment ID. If missing, will generate a random, unique id. 60 * `arn` - (Required) The Amazon Resource Name (ARN) associated of the target. 61 * `input` - (Optional) Valid JSON text passed to the target. 62 * `input_path` - (Optional) The value of the [JSONPath](http://goessner.net/articles/JsonPath/) 63 that is used for extracting part of the matched event when passing it to the target.