-
I've been using CDK for some long time, and I'm upgrading all my stacks from version 1 to version 2 I have base stacks with network, subnets, etc. and then on top of that, I have other stacks with different resources, rds, ec2, ecs, etc. On CDK 1, the cloudformation template generated with CDK was:
On CDK2, it changed to:
on the cdk diff the change is easily visible:
and on deploy it fails, because it is trying to replace the already existant Subnets that already have a lot of resources on them:
so the question is, on CDK 2, is there a way I can set the availability zone to use a cloudformation |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
How have you defined this subnet in your code? |
Beta Was this translation helpful? Give feedback.
-
btw, I also tried to manually update the CDK template in AWS console, by manually updating the template AvailabilityZone from the fn:select function to the hardoced zone the cloudformation manual update works, but it breaks cdk, as when I try to run cdk synth, the public subnets are not generating the |
Beta Was this translation helpful? Give feedback.
-
Thanks for all the detail, one last question before I dive into this, which version of v1 did you upgrade from? |
Beta Was this translation helpful? Give feedback.
-
The difference in availabilityZone behavior actually hasn't changed between versions - your migration likely caused you to make a change to your project which changes how your stack resolves availability zones. If the region and account are specified on your stack and resolved at runtime, then your stack will look up availability zones for the region and store them in
Could you post your full |
Beta Was this translation helpful? Give feedback.
-
We had the same issue with our VpcStack during the upgrade from CDKv1 to CDKv2. Thanks to a colleague and the comment from gshpychka, we figured out what the problem was. The stack was initially created without specifying a region, the region was later added and the stack was never deployed again since then. You'll probably see this in your output too.
|
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
We had the same issue with our VpcStack during the upgrade from CDKv1 to CDKv2. Thanks to a colleague and the comment from gshpychka, we figured out what the problem was. The stack was initially created without specifying a region, the region was later added and the stack was never deployed again since then. You'll probably see this in your output too.