I came upon this thread, https://github.com/aws/aws-cdk/issues/6184 Based on that I was able to get it to work like this:
export class EventBridgeRuleStack extends cdk.Stack {
constructor(
scope: Construct,
id: string,
eventBus: cdk.aws_events.IEventBus,
lambda: cdk.aws_lambda.IFunction,
props?: cdk.StackProps) {
super(scope, id, props);
// Create an EventBridge rule
const rule = new cdk.aws_events.Rule(this, "EventRule", {
eventBus: eventBus,
ruleName: "stripe-event",
eventPattern: {
source: cdk.aws_events.Match.prefix("aws.partner/stripe.com")
}
});
rule.addEventPattern({source: []})
// Add the Lambda function as a target
rule.addTarget(new cdk.aws_events_targets.LambdaFunction(lambda));
}
}