I want a CDK after-deployment trigger. Triggers seem to be limited to lambda functions. I have an existing lambda function I'd like to use. I'm using typescript.
The triggers constructor which expects TriggerProps
which expects a Function
instead of something matching IFunction
. This seems like a flaw/bug in the code?
My desired code is this:
const existingLambda = lambda.Function.fromFunctionArn(
this,
"myExistingLambdaID",
"arn:aws:lambda:us-xxx-1:##########:function:myFunctionName"
);
const ciTrigger = new triggers.Trigger(this, 'MyTrigger', {
handler: existingLambda,
});
However, this rejects with
Type 'IFunction' is missing the following properties from type 'Function': currentVersion, runtime, canCreatePermissions, _layers, and 37 more.ts(2740)
Is there another CDK native way to achieve this? (i don't want to do this in bash, etc)