From 53a18cbff6d3d2d6698e98cf0dd8a7eba21fdf58 Mon Sep 17 00:00:00 2001 From: coyoteecd <47973420+coyoteecd@users.noreply.github.com> Date: Tue, 7 Jan 2020 14:19:39 +0200 Subject: [PATCH] fix: Ensure CF stacks are deleted on failed creaton attempt (#7158) Until now, failed stack deploys when using deploymentBucket to specify an existing bucket were left in ROLLBACK_COMPLETE state. This required manual 'sls remove' before a redeploy. Fixes #6612, follow-up of incomplete fix in #5631 --- lib/plugins/aws/lib/updateStack.js | 2 +- lib/plugins/aws/lib/updateStack.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/aws/lib/updateStack.js b/lib/plugins/aws/lib/updateStack.js index 0677d2d63..9944587b1 100644 --- a/lib/plugins/aws/lib/updateStack.js +++ b/lib/plugins/aws/lib/updateStack.js @@ -24,7 +24,7 @@ module.exports = { const params = { StackName: stackName, - OnFailure: 'ROLLBACK', + OnFailure: 'DELETE', Capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], Parameters: [], TemplateURL: templateUrl, diff --git a/lib/plugins/aws/lib/updateStack.test.js b/lib/plugins/aws/lib/updateStack.test.js index 6398d15ee..a91465c88 100644 --- a/lib/plugins/aws/lib/updateStack.test.js +++ b/lib/plugins/aws/lib/updateStack.test.js @@ -51,7 +51,7 @@ describe('updateStack', () => { expect( createStackStub.calledWithExactly('CloudFormation', 'createStack', { StackName: awsDeploy.provider.naming.getStackName(), - OnFailure: 'ROLLBACK', + OnFailure: 'DELETE', Capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], Parameters: [], TemplateURL: `https://s3.amazonaws.com/${awsDeploy.bucketName}/${awsDeploy.serverless.service.package.artifactDirectoryName}/${compiledTemplateFileName}`,