File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
packages/@aws-cdk/aws-rds Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -507,7 +507,7 @@ abstract class DatabaseInstanceNew extends DatabaseInstanceBase implements IData
507
507
this . newCfnProps = {
508
508
autoMinorVersionUpgrade : props . autoMinorVersionUpgrade ,
509
509
availabilityZone : props . multiAz ? undefined : props . availabilityZone ,
510
- backupRetentionPeriod : props . backupRetentionPeriod ? props . backupRetentionPeriod . toString ( ) : undefined ,
510
+ backupRetentionPeriod : props . backupRetentionPeriod !== undefined ? props . backupRetentionPeriod . toString ( ) : undefined ,
511
511
copyTagsToSnapshot : props . copyTagsToSnapshot !== undefined ? props . copyTagsToSnapshot : true ,
512
512
dbInstanceClass : `db.${ props . instanceClass } ` ,
513
513
dbInstanceIdentifier : props . instanceIdentifier ,
Original file line number Diff line number Diff line change @@ -406,6 +406,28 @@ export = {
406
406
]
407
407
} ) ;
408
408
409
+ test . done ( ) ;
410
+ } ,
411
+
412
+ 'can deactivate backup' ( test : Test ) {
413
+ // GIVEN
414
+ const stack = new cdk . Stack ( ) ;
415
+ const vpc = new ec2 . Vpc ( stack , 'VPC' ) ;
416
+
417
+ // WHEN
418
+ new rds . DatabaseInstance ( stack , 'Instance' , {
419
+ engine : rds . DatabaseInstanceEngine . Mysql ,
420
+ instanceClass : new ec2 . InstanceTypePair ( ec2 . InstanceClass . Burstable2 , ec2 . InstanceSize . Small ) ,
421
+ masterUsername : 'admin' ,
422
+ vpc,
423
+ backupRetentionPeriod : 0 ,
424
+ } ) ;
425
+
426
+ // THEN
427
+ expect ( stack ) . to ( haveResource ( 'AWS::RDS::DBInstance' , {
428
+ BackupRetentionPeriod : '0'
429
+ } ) ) ;
430
+
409
431
test . done ( ) ;
410
432
}
411
433
} ;
You can’t perform that action at this time.
0 commit comments