Skip to content

Switch CloudFormation OnFailure behaviour to rollback instead of dele… - #2125

Merged
flomotlik merged 1 commit into
serverless:masterfrom
rowanu:rollback-on-cfn-failure
Sep 23, 2016
Merged

flomotlik merged 1 commit into
serverless:masterfrom
rowanu:rollback-on-cfn-failure

Conversation

@rowanu

@rowanu rowanu commented Sep 14, 2016

Copy link
Copy Markdown
Contributor

What did you implement:

_Implementing Issue:_ #2087

How did you implement it:

The existing behaviour of DELETE on CFN failure resulted in confusing outputs, that sometimes appeared as success. It also resulted in a race condition where a failure might not be seen at all due to CFN status polling (see my comment on #2087 for details).

Here's the docs that correspond to the setting.

I specifically chose ROLLBACK over DO_NOTHING because in a vast majority of cases, rollback will work fine - the user will get the error message that caused the rollback, and they can investigate the root cause in the stack (which is no longer deleted). This will work best for the most common scenario - the user has tried to create a resource they don't have permission to create (again, see #2087).

In the unlikely event of a failure that leaves the stack in some other state, the stack will probably need to be deleted and recreated. This would be the case even if DO_NOTHING was specified.

How can we verify it:

  • Using a IAM User/Role that doesn't have S3 create permissions, launch a new stack

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config/commands/resources
  • Leave a comment that this is ready for review once you've finished the implementation

@rowanu

rowanu commented Sep 14, 2016

Copy link
Copy Markdown
Contributor Author

This is a work in progress - leaving a stack in ROLLBACK_COMPLETE state doesn't seem to be supported.

@colbywhite

Copy link
Copy Markdown
Contributor

they can investigate the root cause in the stack (which is no longer deleted).

If you rollback, it is true that the stack won't be deleted, but everything in it will. So they won't be able to investigate any of the resources in the stack, but they will be able to view what CF reports as the cause of error.

That's probably enough though. So I'm not saying you should change it or anything. Just wanted to make sure you were aware of it.

@rowanu

rowanu commented Sep 22, 2016 •

Copy link
Copy Markdown
Contributor Author

the stack (which is no longer deleted).

Yeah, that's why I said exactly that.

I specifically chose (but didn't mention originally) ROLLBACK because it won't leave resources (that may have a cost associated with them) lying around, as opposed to DO_NOTHING, which might.

@flomotlik
flomotlik merged commit 9b5a58c into serverless:master Sep 23, 2016
@flomotlik flomotlik added this to the V1.0 milestone Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants