Coding Spirit

一位程序员,比较帅的那种

AWS Cloudformation allows user attach condition to resource, so resource will be created only if the given condition has been fulfilled(conditional resource). But things get tricky when using AWS CDK, user must use getNode method to get the Cfnxxxxx resource from original CDK resource and attach conditions afterwards. Take S3 Bucket as an example:

1
2
3
((CfnBucket)myBucket.getNode().getDefaultChild()).getCfnOptions().setCondition(
myCondition
);
0%