github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/website/source/docs/providers/aws/r/cloudwatch_event_rule.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_cloudwatch_event_rule" 4 sidebar_current: "docs-aws-resource-cloudwatch-event-rule" 5 description: |- 6 Provides a CloudWatch Event Rule resource. 7 --- 8 9 # aws\_cloudwatch\_event\_rule 10 11 Provides a CloudWatch Event Rule resource. 12 13 ## Example Usage 14 15 ``` 16 resource "aws_cloudwatch_event_rule" "console" { 17 name = "capture-aws-sign-in" 18 description = "Capture each AWS Console Sign In" 19 event_pattern = <<PATTERN 20 { 21 "detail-type": [ 22 "AWS Console Sign In via CloudTrail" 23 ] 24 } 25 PATTERN 26 } 27 28 resource "aws_cloudwatch_event_target" "sns" { 29 rule = "${aws_cloudwatch_event_rule.console.name}" 30 target_id = "SendToSNS" 31 arn = "${aws_sns_topic.aws_logins.arn}" 32 } 33 34 resource "aws_sns_topic" "aws_logins" { 35 name = "aws-console-logins" 36 } 37 ``` 38 39 ## Argument Reference 40 41 The following arguments are supported: 42 43 * `name` - (Required) The rule's name. 44 * `schedule_expression` - (Required, if `event_pattern` isn't specified) The scheduling expression. 45 For example, `cron(0 20 * * ? *)` or `rate(5 minutes)`. 46 * `event_pattern` - (Required, if `schedule_expression` isn't specified) Event pattern 47 described a JSON object. 48 See full documentation of [CloudWatch Events and Event Patterns](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CloudWatchEventsandEventPatterns.html) for details. 49 * `description` - (Optional) The description of the rule. 50 * `role_arn` - (Optional) The Amazon Resource Name (ARN) associated with the role that is used for target invocation. 51 * `is_enabled` - (Optional) Whether the rule should be enabled (defaults to `true`). 52 53 ## Attributes Reference 54 55 The following attributes are exported: 56 57 * `arn` - The Amazon Resource Name (ARN) of the rule.