github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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  ```hcl
    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  
    51  -> **Note:** In order to be able to have your AWS Lambda function or
    52     SNS topic invoked by a CloudWatch Events rule, you must setup the right permissions
    53     using [`aws_lambda_permission`](https://www.terraform.io/docs/providers/aws/r/lambda_permission.html)
    54     or [`aws_sns_topic.policy`](https://www.terraform.io/docs/providers/aws/r/sns_topic.html#policy).
    55     More info [here](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/EventsResourceBasedPermissions.html).
    56  
    57  The following arguments are supported:
    58  
    59  * `rule` - (Required) The name of the rule you want to add targets to.
    60  * `target_id` - (Optional) The unique target assignment ID.  If missing, will generate a random, unique id.
    61  * `arn` - (Required) The Amazon Resource Name (ARN) associated of the target.
    62  * `input` - (Optional) Valid JSON text passed to the target.
    63  * `input_path` - (Optional) The value of the [JSONPath](http://goessner.net/articles/JsonPath/)
    64  	that is used for extracting part of the matched event when passing it to the target.
    65  * `role_arn` - (Optional) The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered.
    66  * `run_command_targets` - (Optional) Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
    67  
    68  `run_command_parameters` support the following:
    69  
    70  * `key` - (Required) Can be either `tag:tag-key` or `InstanceIds`.
    71  * `values` - (Required) If Key is `tag:tag-key`, Values is a list of tag values. If Key is `InstanceIds`, Values is a list of Amazon EC2 instance IDs.
    72