Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

Don't overwrite an existing CFN stack if it's not Zappa #1530

Open scoates opened 6 years ago

scoates commented 6 years ago

So… bad stuff today. I created a new stack called example-backend-qa (outside of Zappa). Then I went to deploy a new zappa stage called qa where "project_name": "example-backend".

This applied Zappa's cloudfront template to my existing stack. This broke things pretty badly.

Possible solution: before updating a stack's template, ensure that the description is "Automatically generated with Zappa" or maybe set a parameter in the stack with the Zappa version (and check to ensure this exists) or something like that.

marpontes commented 4 years ago

Just happened to me 😄 Thankfully I've overwritten a new development environment -- getting my head around with #634.

I suggest the default stack could have a static output such as

Outputs:
  GENERATEDBY:
      Value: Zappa

That could be read using cloudformation

GENERATEDBY=$(aws cloudformation describe-stacks \
  --stack-name <CANDIDATE-STACK-NAME> \
  --query "Stacks[0].Outputs[?OutputKey == 'GENERATEDBY'].{OutputValue:OutputValue}" \
  --output text --no-paginate)