I have a Lambda stack that sits in a repo separate from the Lambda code itself. The Lambda code is packaged and deployed to ECR as a docker image, then the separate Lambda stack references the code as a DockerImageFunction
using the aws_lambda.DockerImageCode.from_ecr()
method. This seemed to have deployed the initial function correctly, but after publishing a new image of the Lambda code to ECR and then running cdk deploy
from the repo with the Lambda stack, it just says that no differences were found. How do I reference my Lambda code in a way that when the constructs are deployed it sees that the code has changed and updates the Lambda function code (like a aws lambda update-function-code
cli call would do)? I've done it before using a code Asset referencing the code local to the Lambda stack (as in, in the same repository), but how does one get a stack to recognize changes in Lambda code when the code isn't referenced as a local Asset?
I realize there is some debate over whether to organize stacks in mono repos or in separate repos with any application code they are responsible for deploying, but for the sake of this discussion I'm more interested in how one would accomplish the updating of Lambda functions when the stack is separate from the code.