Skip to content

Module: cloudwatch_event_target

Associates an EventBridge rule with a target: Lambda function, SSM runbook (Automation document), or direct ARN.

Input Map Key Pattern

Root variable: eb_targets (map of objects). Each key becomes a target logical name.

Field Type Required Description
rule string required Key of the associated eb_rules entry
lambda_function string conditional Name/key of lambda (if targeting lambda)
ssm_runbook string conditional Key of runbook module (if invoking SSM Automation)
arn string conditional Direct target ARN (fallback)
role_arn string optional Role for EventBridge to assume (e.g., SSM automation)
input string optional Static JSON payload
input_path string optional JSONPath to extract part of event
input_transformer object optional Advanced input mapping

Exactly one of lambda_function, ssm_runbook, or arn must be set.

Resolution Logic

  1. If lambda_function provided, resolves to lambda function ARN.
  2. Else if ssm_runbook provided, resolves to SSM document ARN.
  3. Else uses arn directly.

Naming

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

Example

eb_targets = {
  shutdown_target = {
    rule          = "nightly_shutdown"
    ssm_runbook   = "Stop-Instances-Runbook-TF"
    role_arn      = "EventBridge_SSM_AutomationRole"
  }
}