Skip to content

Commit

Permalink
Force deletion of old versions. Aliases can easily be rolled back thr…
Browse files Browse the repository at this point in the history
…ough S3.
  • Loading branch information
Frank Schmid committed Mar 4, 2017
1 parent 592855c commit 21021c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/aliasRestructureStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = {

const functionName = _.replace(_.get(version, 'Properties.FunctionName.Ref'), /LambdaFunction$/, '');

// Remove the function export
// Remove the function version export
delete stageStack.Outputs[`${functionName}LambdaFunctionQualifiedArn`];

// Add function Arn export to stage stack
Expand All @@ -114,6 +114,8 @@ module.exports = {

// Reference correct function name in version
version.Properties.FunctionName = { 'Fn::ImportValue': `${stackName}-${functionName}-LambdaFunctionArn` };
// With alias support we do not want to retain the versions
version.DeletionPolicy = 'Delete';

// Add alias to alias stack. Reference the version export in the stage stack
// to prevent version deletion.
Expand Down

0 comments on commit 21021c1

Please sign in to comment.