Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const resource = new DemoResource(this, 'DemoResource', {
message: 'CustomResource says hello',
});
// Bucket with an invalid name will fail the deployment and cause a rollback
const bucket = new CfnBucket(this, 'FailingBucket', {
bucketName: 'hello!@#$^'
});
// Make sure the rollback gets triggered only after the custom resource has been fully created.
bucket.node.addDependency(resource);
}
}