From e2ea4a323e57a9f5623c6cdc364388020d40a5af Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Fri, 2 Aug 2019 16:19:56 -0700 Subject: [PATCH] fix(events): simplify the cache key for cross-account targets Since events cannot span regions, there's no point keeping the region in the cache (it will always be the same as the rule region). --- packages/@aws-cdk/aws-events/lib/rule.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-events/lib/rule.ts b/packages/@aws-cdk/aws-events/lib/rule.ts index 032d01ed78072..af90c5039ed10 100644 --- a/packages/@aws-cdk/aws-events/lib/rule.ts +++ b/packages/@aws-cdk/aws-events/lib/rule.ts @@ -170,11 +170,10 @@ export class Rule extends Resource implements IRule { } // the _actual_ target is just the event bus of the target's account - // make sure we only add it once per region - const key = `${targetAccount}-${targetRegion}`; - const exists = this.accountEventBusTargets[key]; + // make sure we only add it once per account + const exists = this.accountEventBusTargets[targetAccount]; if (!exists) { - this.accountEventBusTargets[key] = true; + this.accountEventBusTargets[targetAccount] = true; this.targets.push({ id, arn: targetStack.formatArn({