Resource: aws_cloudwatch_event_permission

Provides a resource to create an EventBridge permission to support cross-account events in the current account default event bus.

Example Usage

Account Access

resource "aws_cloudwatch_event_permission" "DevAccountAccess" {
  principal    = "123456789012"
  statement_id = "DevAccountAccess"
}

Organization Access

resource "aws_cloudwatch_event_permission" "OrganizationAccess" {
  principal    = "*"
  statement_id = "OrganizationAccess"

  condition {
    key   = "aws:PrincipalOrgID"
    type  = "StringEquals"
    value = aws_organizations_organization.example.id
  }
}

Argument Reference

This resource supports the following arguments:

condition

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import EventBridge permissions using the event_bus_name/statement_id (if you omit event_bus_name, the default event bus will be used). For example:

import {
  to = aws_cloudwatch_event_permission.DevAccountAccess
  id = "example-event-bus/DevAccountAccess"
}

Using terraform import, import EventBridge permissions using the event_bus_name/statement_id (if you omit event_bus_name, the default event bus will be used). For example:

% terraform import aws_cloudwatch_event_permission.DevAccountAccess example-event-bus/DevAccountAccess