3 ms·
The biggest hurdle I've encountered is cross-stack resource sharing, especially in case of bidirectional dependencies like KMS keys and IAM roles.
by LunaSea 2y ago
The biggest hurdle I've encountered is cross-stack resource sharing, especially in case of bidirectional dependencies like KMS keys and IAM roles.
- 8note 2y agoThe biggest hurdle is when you want to refactor your stacks, and you pretty well just can't, without risk of deleting everything
- irjustin 2y ago> you pretty well just can't, without risk of deleting everything This is one hyper annoying area. It is possible to get around it, but it's ugly, drop to L1 and override logical id: let vpc = new ec2.Vpc(this, 'vpc', { natGateways: 1 }) let cfnVpc = vpc.node.defaultChild as ec2.CfnVPC cfnVpc.overrideLogicalId('MainVpc') You have to do this literally for every resource that's refactored. For us, we run 2 stacks. One that basically cannot/should-not be deleted/refactored. VPC, RDS, critical S3 buckets - i.e. critical data. The 2nd stack runs the software and all those resources can be destroyed, moved whatever w/o any data loss.
- wcchoi 2y ago+1 CDK refactoring is annoying and ugly in my experience you'd need to read the CDK source code to find the offending node and call `overrideLogicalId` there is a library to do it in nicer way: https://github.com/mbonig/cdk-logical-id-mapper https://github.com/mbonig/cdk-logical-id-mapper however it does not work in every case
- nuker 2y ago> we run 2 stacks. One that basically cannot/should-not be deleted/refactored. VPC, RDS, critical S3 buckets Why, dear god, you put VPC and RDS in one stack? They are much better off as separate CFN stacks.
- LunaSea 2y agoThere are deletion protection flags that can be enabled. But circular dependencies can also lead to issues here where CDK will prevent you from deleting a resource used or referenced by a different stack.