Skip to content

aws.eventbridge-rule resource

Description

Rule is an EventBridge rule: a named match, on either an event pattern or a schedule, against an event bus. The fields mirror the EventBridge PutRule API, which is also the call an update makes. The rule name and event bus fix the rule's identity and ARN, so a change to either replaces the rule; the description, event pattern, schedule expression, role, state, and tags all change in place.

EventBridge enforces these bounds itself, so they are not expressed as constraints: the name is at most 64 characters matching ^[0-9A-Za-z_.-]+$, the description is at most 512 characters, the schedule expression is at most 256 characters, and the event pattern is valid JSON of at most 4096 characters.

Source: internal/service/eventbridge/rule_rsrc.go:42

Example usage:

imports: {
  aws: 'github.com/cloudboss/unobin-library-aws'
}

resources: {
  example: aws.eventbridge-rule {
    # Set input fields here.
  }
}

Inputs

name

string

required

event-bus-name

optional(string)

description

optional(string)

event-pattern

optional(string)

schedule-expression

optional(string)

role-arn

optional(string)

state

optional(string)

tags

map(string)

force-destroy

optional(boolean)

Input Constraints

Field combinations

At least one of event-pattern or schedule-expression.

State rules

state must be ENABLED, DISABLED, or ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS.

Rule logic
When
input.state != null
Require
input.state == 'ENABLED'
|| input.state == 'DISABLED'
|| input.state == 'ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS'

Outputs

arn

string