In account A, I have set up an event rule. In account B, I have a custom event bus that needs to act as the target for the event rule in account A.
I found a helpful guide on Stack Overflow, but it was specific to CloudFormation.
I am providing another account's custom event bus ARN as props.
When running cdk deploy, I encountered an error stating that the resource of undefined length could not be found.
const eventRule = new events.Rule(this, 'event-rule', {
ruleName: getResourceName(this, 'event-rule', 'rule-name', props.envName),
description: 'This rule will be used to capture events',
eventPattern: {"source": ['source']},
})
eventRule.addTarget(new eventTarget.EventBus(props.anotherAccountEventBusArn))