From 90a4f94d52929aa14aa16cadaf2e89cad4122684 Mon Sep 17 00:00:00 2001 From: Carlos Rojas Date: Tue, 9 Feb 2021 18:01:55 +0000 Subject: [PATCH] allow select region for cross account target bus --- lib/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 03a5fc5..b0b9ca6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -117,6 +117,7 @@ class ServerlessPlugin { const eventBusName = account.eventBusName; const ruleName = account.ruleName || `EventRuleCase${account.targetAccountId}`; const alphaNumericRuleName = ruleName.replace(/[^a-z0-9+]+/gi, ''); + const region = account.region || 'eu-central-1'; return { [alphaNumericRuleName]: { @@ -128,7 +129,7 @@ class ServerlessPlugin { "State" : "ENABLED", "Targets" : [ { - "Arn": `arn:aws:events:eu-central-1:${account.targetAccountId}:event-bus/default`, + "Arn": `arn:aws:events:${region}:${account.targetAccountId}:event-bus/default`, "RoleArn": {"Fn::GetAtt": [this.eventBridgeIamRole, "Arn"]}, "Id": `targetId_${account.targetAccountId}` }