Skip to content

Commit a257846

Browse files
authored
fix(events): cannot have more than one cross-account Rule (#19441)
Fixes #12479, Resolves #12538 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c94c277 commit a257846

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/@aws-cdk/aws-events/lib/rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export class Rule extends Resource implements IRule {
397397
});
398398
new CfnEventBusPolicy(eventBusPolicyStack, 'GivePermToOtherAccount', {
399399
action: 'events:PutEvents',
400-
statementId: `Allow-account-${sourceAccount}`,
400+
statementId: `Allow-account-${sourceAccount}-${this.node.addr}`,
401401
principal: sourceAccount,
402402
});
403403
}

packages/@aws-cdk/aws-events/test/rule.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,7 @@ describe('rule', () => {
901901
const app = new cdk.App();
902902

903903
const sourceAccount = '123456789012';
904+
const nodeAddr = 'c810f4680339b01edf1f157c4fd07da73469742773';
904905
const sourceStack = new cdk.Stack(app, 'SourceStack', {
905906
env: {
906907
account: sourceAccount,
@@ -982,7 +983,7 @@ describe('rule', () => {
982983
const eventBusPolicyStack = app.node.findChild(`EventBusPolicy-${sourceAccount}-us-west-2-${targetAccount}`) as cdk.Stack;
983984
Template.fromStack(eventBusPolicyStack).hasResourceProperties('AWS::Events::EventBusPolicy', {
984985
'Action': 'events:PutEvents',
985-
'StatementId': `Allow-account-${sourceAccount}`,
986+
'StatementId': `Allow-account-${sourceAccount}-${nodeAddr}`,
986987
'Principal': sourceAccount,
987988
});
988989
});

0 commit comments

Comments
 (0)