Module: cloudwatch-events
This is terraform-aws-cloudwatch-events module that creates CloudWatch Events rules and according targets.
Amazon CloudWatch Events delivers a near real-time stream of system events that describe changes in Amazon Web Services (AWS) resources. Using simple rules that you can quickly set up, you can match events and route them to one or more target functions or streams. CloudWatch Events becomes aware of operational changes as they occur. CloudWatch Events responds to these operational changes and takes corrective action as necessary, by sending messages to respond to the environment, activating functions, making changes, and capturing state information.
Usage
Here's how to invoke this example module in your projects
module "cloudwatch_event" {
source = "cloudposse/cloudwatch-events/aws"
version = "0.7.0"
name = var.name
namespace = var.namespace
tenant = var.tenant
environment = var.environment
stage = var.stage
cloudwatch_event_rule_description = var.cloudwatch_event_rule_description
cloudwatch_event_rule_pattern = var.cloudwatch_event_rule_pattern_json
cloudwatch_event_target_arn = module.sns.sns_topic.arn
}
Variables
Required Variables
cloudwatch_event_rule_pattern(any) requiredEvent pattern described a HCL map which will be encoded as JSON with jsonencode function. See full documentation of CloudWatch Events and Event Patterns for details. http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CloudWatchEventsandEventPatterns.html
cloudwatch_event_target_arn(string) requiredThe Amazon Resource Name (ARN) associated of the target.
Optional Variables
cloudwatch_event_rule_description(string) optionalThe description of the rule.
Default value:
""cloudwatch_event_rule_is_enabled(bool) optionalDEPRECATED (use
cloudwatch_event_rule_stateinstead): Whether the rule should be enabled. Conflicts withcloudwatch_event_rule_is_enabledDefault value:
nullcloudwatch_event_rule_state(string) optionalState of the rule. Valid values are DISABLED, ENABLED, and ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS.
When state is ENABLED, the rule is enabled for all events except those delivered by CloudTrail.
To also enable the rule for events delivered by CloudTrail, set state to ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS.Default value:
"ENABLED"cloudwatch_event_target_id(string) optionalThe unique target assignment ID. If missing, will generate a random, unique id.
Default value:
nullcloudwatch_event_target_role_arn(string) optionalIAM role to be used for this target when the rule is triggered.
Default value:
nulldead_letter_queue_enabled(bool) optionalEnable a Dead Letter Queue (SQS) for failed event deliveries. Useful for troubleshooting delivery issues.
Default value:
falsedead_letter_queue_message_retention_seconds(number) optionalNumber of seconds to retain messages in the Dead Letter Queue.
Default value:
1209600