bref icon indicating copy to clipboard operation
bref copied to clipboard

If the first deployment fails, we need to delete the stack to be able to deploy again

Open mnapoli opened this issue 6 years ago • 4 comments

I am opening this issue to expose the problem and discuss solutions.

When deploying a CloudFormation (template.yaml) stack for the first time, if it fails for any reason the stack will be left in a broken state (ROLLBACK_FAILED).

It needs to be manually deleted in the CloudFormation dashboard, else other deployments will fail with:

An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack:arn:aws:cloudformation:... is in ROLLBACK_FAILED state and can not be updated.

Solutions?

  • a bref command to clean the stack? (maybe a bref doctor command could help explain the problem as well?)
  • better documentation?

mnapoli avatar Mar 23 '19 09:03 mnapoli

I like the idea of bref doctor. It could simply return 'have you checked the region?'

nealio82 avatar Mar 26 '19 11:03 nealio82

'have you checked the region?'

haha that's the easiest way I've seen yet to cover 80% of errors 😄

mnapoli avatar Mar 26 '19 12:03 mnapoli

Tried to deploy the first time (with the region) but it failed as I expected (rarely things work the first time).

I looked at the CloudFormation dashboard and status was: ROLLBACK_FAILED

So after reading this thread I deleted the stack and redeployed and failed again.

I ran "aws cloudformation describe-stack-events --stack-name xxxxxx --region us-east-1" and got a bunch of JSON stuff and the first error was:

"StackId": "arn:aws:cloudformation:us-east-1:xxxxxxx", "EventId": "ArtisanRole-CREATE_FAILED-2019-06-18T05:23:17.448Z", "StackName": "xxxxx", "LogicalResourceId": "ArtisanRole", "PhysicalResourceId": "xxxxx-ArtisanRole-1RVSJ764BUTWX", "ResourceType": "AWS::IAM::Role", "Timestamp": "2019-06-18T05:23:17.448Z", "ResourceStatus": "CREATE_FAILED",

I am using an user with all privileges, this is confusing and totally stuck.

incoming-th avatar Jun 18 '19 05:06 incoming-th

@MickaelTH just so you are aware, there is a new bref deployment command that will help you diagnose what went wrong with the latest deployments. That way you don't have to mess manually with aws cloudformation describe-stack-events.

mnapoli avatar Jun 18 '19 07:06 mnapoli

AFAIK this has been fixed in serverless framework.

mnapoli avatar Dec 01 '22 17:12 mnapoli