github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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  ```hcl
    16  resource "aws_cloudwatch_event_rule" "console" {
    17    name        = "capture-aws-sign-in"
    18    description = "Capture each AWS Console Sign In"
    19  
    20    event_pattern = <<PATTERN
    21  {
    22    "detail-type": [
    23      "AWS Console Sign In via CloudTrail"
    24    ]
    25  }
    26  PATTERN
    27  }
    28  
    29  resource "aws_cloudwatch_event_target" "sns" {
    30    rule      = "${aws_cloudwatch_event_rule.console.name}"
    31    target_id = "SendToSNS"
    32    arn       = "${aws_sns_topic.aws_logins.arn}"
    33  }
    34  
    35  resource "aws_sns_topic" "aws_logins" {
    36    name = "aws-console-logins"
    37  }
    38  ```
    39  
    40  ## Argument Reference
    41  
    42  The following arguments are supported:
    43  
    44  * `name` - (Required) The rule's name.
    45  * `schedule_expression` - (Required, if `event_pattern` isn't specified) The scheduling expression.
    46  	For example, `cron(0 20 * * ? *)` or `rate(5 minutes)`.
    47  * `event_pattern` - (Required, if `schedule_expression` isn't specified) Event pattern
    48  	described a JSON object.
    49  	See full documentation of [CloudWatch Events and Event Patterns](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CloudWatchEventsandEventPatterns.html) for details.
    50  * `description` - (Optional) The description of the rule.
    51  * `role_arn` - (Optional) The Amazon Resource Name (ARN) associated with the role that is used for target invocation.
    52  * `is_enabled` - (Optional) Whether the rule should be enabled (defaults to `true`).
    53  
    54  ## Attributes Reference
    55  
    56  The following attributes are exported:
    57  
    58  * `arn` - The Amazon Resource Name (ARN) of the rule.
    59  
    60  
    61  ## Import
    62  
    63  Cloudwatch Event Rules can be imported using the `name`, e.g.
    64  
    65  ```
    66  $ terraform import aws_cloudwatch_event_rule.console capture-console-sign-in
    67  ```