in infra/stack/serverless-stack.ts [42:62]
private createLambdaFunctionTopic(table: ddb.Table, topic: sns.Topic): lambda.Function {
const path = 'codes/lambda/topic-function/src';
const func = new lambda.Function(this, 'topic-function', {
functionName: `${this.stackName}-topic-function`,
runtime: lambda.Runtime.PYTHON_3_6,
handler: 'handler.handle',
code: lambda.Code.fromAsset(path),
environment: {
"TABLE_NAME": table.tableName
}
});
func.addEventSource(new lambdaEvent.SnsEventSource(topic, {
}));
table.grantWriteData(func);
return func;
}