Skip to content

Commit

Permalink
Merge pull request #22 from c4e/feature/allow-add-region-rule
Browse files Browse the repository at this point in the history
allow select region for cross account target bus
  • Loading branch information
c4e authored Feb 9, 2021
2 parents eaee6ee + 90a4f94 commit 8fbd21c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]: {
Expand All @@ -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}`
}
Expand Down

0 comments on commit 8fbd21c

Please sign in to comment.