Deploy doesn't update Lambdas when using artifacts
IPWright83 opened this issue · comments
So I've been trying to deploy some Lambdas with this, using the artifacts approach and I've discovered that while the first deploy works, updates to the stack don't work properly.
After doing some searching, I believe the S3Key
needs to be rotated in the CloudFormation, but this would also be the case for the cfpack.config.js
. Is there a way to introduce variables in to trigger some sort of automatic rotation?
Hi @IPWright83
how about using something like this:
template file
Parameters:
LambdaFunctionAS3Key:
Type: String
Description: ...
Resources:
LambdaFunctionA:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Role: ...
Code:
S3Bucket: my-bucket
S3Key: !Ref LambdaFunctionAS3Key
Runtime: nodejs8.10
...
cfpack.config.js
const lambdaAFilename = `lambdas/function-a.${ +new Date }.zip`;
module.exports = {
...
stack: {
name: "my-stack",
region: "us-east-1",
params: {
{
ParameterKey: 'LambdaFunctionAS3Key',
ParameterValue: lambdaAFilename,
},
},
artifacts: [
{
bucket: "my-bucket",
files: {
[lambdaAFilename]: {
baseDir: "lambdas/functionA",
path: "**/*",
compression: "zip"
},
}
}
]
}
};
That sounds like a great idea @eugene-manuilov, I hadn't thought of trying to inject parameters. I'm fairly sure that'll work so going to close. Thank you 👍🏻