Skip to content

Commit e5de00c

Browse files
committed
CCM-12745: add permissions to send events
1 parent d02b529 commit e5de00c

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

infrastructure/terraform/components/dl/module_lambda_ttl_create.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,17 @@ data "aws_iam_policy_document" "ttl_create_lambda" {
8787
module.sqs_ttl.sqs_queue_arn,
8888
]
8989
}
90+
91+
statement {
92+
sid = "PutEvents"
93+
effect = "Allow"
94+
95+
actions = [
96+
"events:PutEvents",
97+
]
98+
99+
resources = [
100+
aws_cloudwatch_event_bus.main.arn,
101+
]
102+
}
90103
}

utils/utils/src/event-publish/event-publish.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ export class EventPublisher {
5555
eventBusArn: this.config.eventBusArn,
5656
batchSize: batch.length,
5757
});
58-
const entries = batch.map((event) => ({
59-
Source: 'custom.event',
60-
DetailType: event.type,
61-
Detail: JSON.stringify(event),
62-
EventBusName: this.config.eventBusArn,
63-
}));
6458

6559
try {
60+
const entries = batch.map((event) => ({
61+
Source: 'custom.event',
62+
DetailType: event.type,
63+
Detail: JSON.stringify(event),
64+
EventBusName: this.config.eventBusArn,
65+
}));
66+
6667
const response = await this.eventBridge.send(
6768
new PutEventsCommand({ Entries: entries }),
6869
);
@@ -123,6 +124,8 @@ export class EventPublisher {
123124
}),
124125
);
125126

127+
this.logger.debug({response});
128+
126129
if (response.Failed)
127130
for (const failedEntry of response.Failed) {
128131
const failedEvent =

0 commit comments

Comments
 (0)