Skip to content

Module: cloudwatch_event_rule

Defines an EventBridge rule used to schedule or filter events that trigger automation (Lambda or SSM runbooks).

Input Map Key Pattern

Root variable: eb_rules (map of objects). Each key becomes a rule logical name.

Field Type Required Description
description string optional Human readable purpose
schedule_expression string conditional CRON or rate expression (required for schedule-based rules)
event_pattern object/map conditional Event pattern JSON object (alternative to schedule)
role_arn string optional Execution role if needed for cross-account targets
tags map(string) optional Additional tags

Only one of schedule_expression or event_pattern should be supplied.

Behavior

  • Name derived unless explicitly provided: ${prefixes.eb_rule}${key}${suffixes.eb_rule}.

Example

eb_rules = {
  nightly_shutdown = {
    description         = "Nightly EC2 pilot shutdown"
    schedule_expression = "cron(20 0 ? * * *)"
  }
}