Skip to content

Commit

Permalink
refactor: Add EventBridge permission for lambda function
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeCarillo committed Jun 10, 2024
1 parent 0191985 commit 7016a1d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/helpers/functions/event_bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ export class EventBridgeManager {
},
],
}).promise();

// Add permission to Lambda function
await this.lambda.addPermission({
FunctionName: lambda_function,
StatementId: rule_name,
Action: "lambda:InvokeFunction",
Principal: "events.amazonaws.com",
SourceArn: "arn:aws:events:" + process.env.AWS_REGION + ":" + process.env.AWS_ACCOUNT_ID + ":rule/" + rule_name,
}).promise();

return true;
}

public async delete_trigger(rule_name: string, lambda_function: string): Promise<boolean> {
Expand Down

0 comments on commit 7016a1d

Please sign in to comment.