provider/aws: Document CloudWatch Events

This commit is contained in:
Radek Simko 2016-02-04 23:19:30 +00:00
parent 30082a4c85
commit e288b161d7
3 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1,57 @@
---
layout: "aws"
page_title: "AWS: aws_cloudwatch_event_rule"
sidebar_current: "docs-aws-resource-cloudwatch-event-rule"
description: |-
Provides a CloudWatch Event Rule resource.
---
# aws\_cloudwatch\_event\_rule
Provides a CloudWatch Event Rule resource.
## Example Usage
```
resource "aws_cloudwatch_event_rule" "console" {
name = "capture-aws-sign-in"
description = "Capture each AWS Console Sign In"
event_pattern = <<PATTERN
{
"detail-type": [
"AWS Console Sign In via CloudTrail"
]
}
PATTERN
}
resource "aws_cloudwatch_event_target" "sns" {
rule = "${aws_cloudwatch_event_rule.console.name}"
target_id = "SendToSNS"
arn = "${aws_sns_topic.aws_logins.arn}"
}
resource "aws_sns_topic" "aws_logins" {
name = "aws-console-logins"
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The rule's name.
* `schedule_expression` - (Required, if `event_pattern` isn't specified) The scheduling expression.
For example, `cron(0 20 * * ? *)` or `rate(5 minutes)`.
* `event_pattern` - (Required, if `schedule_expression` isn't specified) Event pattern
described a JSON object.
See full documentation of [CloudWatch Events and Event Patterns](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CloudWatchEventsandEventPatterns.html) for details.
* `description` - (Optional) The description of the rule.
* `role_arn` - (Optional) The Amazon Resource Name (ARN) associated with the role that is used for target invocation.
* `is_enabled` - (Optional) Whether the rule should be enabled (defaults to `true`).
## Attributes Reference
The following attributes are exported:
* `arn` - The Amazon Resource Name (ARN) of the rule.

View File

@ -0,0 +1,57 @@
---
layout: "aws"
page_title: "AWS: aws_cloudwatch_event_target"
sidebar_current: "docs-aws-resource-cloudwatch-event-target"
description: |-
Provides a CloudWatch Event Target resource.
---
# aws\_cloudwatch\_event\_target
Provides a CloudWatch Event Target resource.
## Example Usage
```
resource "aws_cloudwatch_event_target" "yada" {
target_id = "Yada"
rule = "${aws_cloudwatch_event_rule.console.arn}"
arn = "${aws_kinesis_stream.test_stream.arn}"
}
resource "aws_cloudwatch_event_rule" "console" {
name = "capture-ec2-scaling-events"
description = "Capture all EC2 scaling events"
event_pattern = <<PATTERN
{
"source": [
"aws.autoscaling"
],
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful"
]
}
PATTERN
}
resource "aws_kinesis_stream" "test_stream" {
name = "terraform-kinesis-test"
shard_count = 1
}
```
## Argument Reference
-> **Note:** `input` and `input_path` are mutually exclusive options.
The following arguments are supported:
* `rule` - (Required) The name of the rule you want to add targets to.
* `target_id` - (Required) The unique target assignment ID.
* `arn` - (Required) The Amazon Resource Name (ARN) associated of the target.
* `input` - (Optional) Valid JSON text passed to the target.
* `input_path` - (Optional) The value of the [JSONPath](http://goessner.net/articles/JsonPath/)
that is used for extracting part of the matched event when passing it to the target.

View File

@ -31,6 +31,13 @@
<li<%= sidebar_current(/^docs-aws-resource-cloudwatch/) %>> <li<%= sidebar_current(/^docs-aws-resource-cloudwatch/) %>>
<a href="#">CloudWatch Resources</a> <a href="#">CloudWatch Resources</a>
<ul class="nav nav-visible"> <ul class="nav nav-visible">
<li<%= sidebar_current("docs-aws-resource-cloudwatch-event-rule") %>>
<a href="/docs/providers/aws/r/cloudwatch_event_rule.html">aws_cloudwatch_event_rule</a>
</li>
<li<%= sidebar_current("docs-aws-resource-cloudwatch-event-target") %>>
<a href="/docs/providers/aws/r/cloudwatch_event_target.html">aws_cloudwatch_event_target</a>
</li>
<li<%= sidebar_current("docs-aws-resource-cloudwatch-log-group") %>> <li<%= sidebar_current("docs-aws-resource-cloudwatch-log-group") %>>
<a href="/docs/providers/aws/r/cloudwatch_log_group.html">aws_cloudwatch_log_group</a> <a href="/docs/providers/aws/r/cloudwatch_log_group.html">aws_cloudwatch_log_group</a>