Skip to content

Commit ca0fd0b

Browse files
copy fixes from base commit
1 parent 1e81bf9 commit ca0fd0b

File tree

8 files changed

+11
-10
lines changed

8 files changed

+11
-10
lines changed

infrastructure/terraform/components/api/module_lambda_mi_stream_forwarder.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module "mi_stream_forwarder" {
3636
log_subscription_role_arn = local.acct.log_subscription_role_arn
3737

3838
lambda_env_vars = merge(local.common_lambda_env_vars, {
39-
MI_CHANGE_STREAM_NAME = "mi_change_stream"
39+
MI_CHANGE_STREAM_ARN = "${aws_kinesis_stream.mi_change_stream.arn}"
4040
})
4141
}
4242

@@ -63,7 +63,8 @@ data "aws_iam_policy_document" "mi_stream_forwarder_lambda" {
6363
effect = "Allow"
6464

6565
actions = [
66-
"kinesis:*"
66+
"kinesis:DescribeStream",
67+
"kinesis:PutRecord",
6768
]
6869

6970
resources = [

infrastructure/terraform/components/api/module_lambda_mi_updates_transformer.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module "mi_updates_transformer" {
3636
log_subscription_role_arn = local.acct.log_subscription_role_arn
3737

3838
lambda_env_vars = merge(local.common_lambda_env_vars, {
39-
EVENTPUB_SNS_TOPIC_ARN = module.eventpub.sns_topic.arn
39+
EVENTPUB_SNS_TOPIC_ARN = "${module.eventpub.sns_topic.arn}"
4040
})
4141
}
4242

lambdas/mi-stream-forwarder/src/__tests__/mi-stream-forwarder.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('mi-stream-forwarder Lambda', () => {
1111
const mockedDeps: jest.Mocked<Deps> = {
1212
kinesisClient: { send: jest.fn()} as unknown as KinesisClient,
1313
env: {
14-
MI_CHANGE_STREAM_NAME: "test-stream",
14+
MI_CHANGE_STREAM_ARN: "test-stream",
1515
} as unknown as EnvVars
1616
} as Deps;
1717

@@ -36,7 +36,7 @@ describe('mi-stream-forwarder Lambda', () => {
3636
expect(mockedDeps.kinesisClient.send).toHaveBeenCalledWith(
3737
expect.objectContaining({
3838
input: expect.objectContaining({
39-
StreamName: 'test-stream',
39+
StreamARN: 'test-stream',
4040
PartitionKey: 'mi-123',
4141
}),
4242
})

lambdas/mi-stream-forwarder/src/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { z } from 'zod';
22

33
const EnvVarsSchema = z.object({
4-
MI_CHANGE_STREAM_NAME: z.string(),
4+
MI_CHANGE_STREAM_ARN: z.string(),
55
});
66

77
export type EnvVars = z.infer<typeof EnvVarsSchema>;

lambdas/mi-stream-forwarder/src/mi-stream-forwarder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function createHandler(deps: Deps): Handler<DynamoDBStreamEvent> {
1313
const newImage = record.dynamodb?.NewImage!;
1414
const miRecord = unmarshall(newImage as any) as MI;
1515
await deps.kinesisClient.send(new PutRecordCommand({
16-
StreamName: deps.env.MI_CHANGE_STREAM_NAME,
16+
StreamARN: deps.env.MI_CHANGE_STREAM_ARN,
1717
PartitionKey: miRecord.id,
1818
Data: Buffer.from(JSON.stringify(miRecord)),
1919
}));

lambdas/mi-updates-transformer/src/__tests__/mi-updates-transformer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('mi-updates-transformer Lambda', () => {
2222
snsClient: { send: jest.fn()} as unknown as SNSClient,
2323
logger: { info: jest.fn(), error: jest.fn() } as unknown as pino.Logger,
2424
env: {
25-
EVENT_PUB_SNS_TOPIC_ARN: 'arn:aws:sns:region:account:topic',
25+
EVENTPUB_SNS_TOPIC_ARN: 'arn:aws:sns:region:account:topic',
2626
} as unknown as EnvVars
2727
} as Deps;
2828

lambdas/mi-updates-transformer/src/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {z} from 'zod';
22

33
const EnvVarsSchema = z.object({
4-
EVENT_PUB_SNS_TOPIC_ARN: z.string(),
4+
EVENTPUB_SNS_TOPIC_ARN: z.string(),
55
});
66

77
export type EnvVars = z.infer<typeof EnvVarsSchema>;

lambdas/mi-updates-transformer/src/mi-updates-transformer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function createHandler(deps: Deps): Handler<KinesisStreamEvent> {
2222

2323
for (let batch of generateBatches(cloudEvents)) {
2424
await deps.snsClient.send(new PublishBatchCommand({
25-
TopicArn: deps.env.EVENT_PUB_SNS_TOPIC_ARN,
25+
TopicArn: deps.env.EVENTPUB_SNS_TOPIC_ARN,
2626
PublishBatchRequestEntries: batch.map(buildMessage),
2727
}));
2828
}

0 commit comments

Comments
 (0)