Here is my CDK code:
const addVersion = (resourcePrefix: string, lambda: NodejsFunction) => {
const version = new Version(this, `${resourcePrefix}Version`, {
lambda,
});
const alias = new Alias(this, `${resourcePrefix}VersionAlias`, {
aliasName: 'current',
version,
});
alias.node.addDependency(version);
}
The first deployment succeeds, subsequent deployments fail. I'm assuming it's because CDK is attempting to create a new version of the Lambda function each time even when the source code has not been modified. How can I get it to stop doing this?