0

We had an error that occurred when two deploys were triggered pretty much simultaneously which in turn triggered an error:

Error [ValidationError]: Stack:arn:aws:cloudformation:[stack] is in UPDATE_IN_PROGRESS state and can not be updated

So I found that you can set wait and stack-update-complete in cloudformation to wait before trying to update.

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/wait/stack-update-complete.html

But how am I to use it with the CDK deploy cli?

Patrik
  • 2,207
  • 3
  • 30
  • 48
  • Does this https://stackoverflow.com/questions/57518054/how-to-wait-stack-to-complete-before-executing-code-in-aws-cdk help? – kgiannakakis Nov 11 '21 at 12:23
  • @kgiannakakis I don't think so. I want to wait to deploy if there is already a deployment in progress of the same stack. – Patrik Nov 11 '21 at 12:34

1 Answers1

1

You can't do this in CDK. You can do it manually with the aws cli, as described in the link in your question.

aws cloudformation wait stack-update-complete --stack-name MyStack && cdk deploy MyStack

gshpychka
  • 8,523
  • 1
  • 11
  • 31
  • Aah ok. Didn't know cloudformation modified the stack. Thanks! – Patrik Nov 11 '21 at 13:28
  • CDK code synthesizes a Cloudformation template, and Cloudformation is what's deploying the resources. – gshpychka Nov 12 '21 at 16:27
  • @Patrik given this restriction, if you add your CDK deployment to a pipeline, in its own stage, it will not trigger a second time until the first triggered one is complete. Manual deployment however can and will run into this situation often. – lynkfox Nov 12 '21 at 17:29