Skip to content

Commit

Permalink
Merge pull request #14 from c4e/feature/enhance-statementId
Browse files Browse the repository at this point in the history
remove non alphaNumeric ruleName
  • Loading branch information
c4e authored Jun 26, 2020
2 parents f340f6c + f877ea2 commit 583da84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ class ServerlessPlugin {
const targetAccounts = this.eventBridgeCrossOrganization.sendEvents;
const rulesTemplate = targetAccounts.map(account => {
const ruleName = account.ruleName || `EventRuleCase${account.targetAccountId}`;
const alphaNumericRuleName = ruleName.replace(/[^a-z0-9+]+/gi, '');

return {
[ruleName]: {
[alphaNumericRuleName]: {
"Type" : "AWS::Events::Rule",
"Properties" : {
"Name" : ruleName,
"Name" : alphaNumericRuleName,
"EventBusName" : "default",
"EventPattern" : account.pattern,
"State" : "ENABLED",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-events-cross-organization",
"version": "v1.0.8-beta",
"version": "v1.0.9-beta",
"description": "Add roles, rules, policies to send and receive events cross organization",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 583da84

Please sign in to comment.