@@ -321,6 +321,13 @@ export abstract class DatabaseClusterBase extends Resource implements IDatabaseC
321
321
*/
322
322
public abstract readonly clusterIdentifier : string ;
323
323
324
+ /**
325
+ * The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP.
326
+ *
327
+ * This AWS Region-unique identifier is used in things like IAM authentication policies.
328
+ */
329
+ public abstract readonly clusterResourceIdentifier : string ;
330
+
324
331
/**
325
332
* Identifiers of the replicas
326
333
*/
@@ -557,6 +564,7 @@ class ImportedDatabaseCluster extends DatabaseClusterBase implements IDatabaseCl
557
564
public readonly connections : ec2 . Connections ;
558
565
public readonly engine ?: IClusterEngine ;
559
566
567
+ private readonly _clusterResourceIdentifier ?: string ;
560
568
private readonly _clusterEndpoint ?: Endpoint ;
561
569
private readonly _clusterReadEndpoint ?: Endpoint ;
562
570
private readonly _instanceIdentifiers ?: string [ ] ;
@@ -566,6 +574,7 @@ class ImportedDatabaseCluster extends DatabaseClusterBase implements IDatabaseCl
566
574
super ( scope , id ) ;
567
575
568
576
this . clusterIdentifier = attrs . clusterIdentifier ;
577
+ this . _clusterResourceIdentifier = attrs . clusterResourceIdentifier ;
569
578
570
579
const defaultPort = attrs . port ? ec2 . Port . tcp ( attrs . port ) : undefined ;
571
580
this . connections = new ec2 . Connections ( {
@@ -582,6 +591,13 @@ class ImportedDatabaseCluster extends DatabaseClusterBase implements IDatabaseCl
582
591
: undefined ;
583
592
}
584
593
594
+ public get clusterResourceIdentifier ( ) {
595
+ if ( ! this . _clusterResourceIdentifier ) {
596
+ throw new Error ( 'Cannot access `clusterResourceIdentifier` of an imported cluster without a clusterResourceIdentifier' ) ;
597
+ }
598
+ return this . _clusterResourceIdentifier ;
599
+ }
600
+
585
601
public get clusterEndpoint ( ) {
586
602
if ( ! this . _clusterEndpoint ) {
587
603
throw new Error ( 'Cannot access `clusterEndpoint` of an imported cluster without an endpoint address and port' ) ;
@@ -637,6 +653,7 @@ export class DatabaseCluster extends DatabaseClusterNew {
637
653
}
638
654
639
655
public readonly clusterIdentifier : string ;
656
+ public readonly clusterResourceIdentifier : string ;
640
657
public readonly clusterEndpoint : Endpoint ;
641
658
public readonly clusterReadEndpoint : Endpoint ;
642
659
public readonly connections : ec2 . Connections ;
@@ -662,6 +679,7 @@ export class DatabaseCluster extends DatabaseClusterNew {
662
679
} ) ;
663
680
664
681
this . clusterIdentifier = cluster . ref ;
682
+ this . clusterResourceIdentifier = cluster . attrDbClusterResourceId ;
665
683
666
684
if ( secret ) {
667
685
this . secret = secret . attach ( this ) ;
@@ -729,6 +747,7 @@ export interface DatabaseClusterFromSnapshotProps extends DatabaseClusterBasePro
729
747
*/
730
748
export class DatabaseClusterFromSnapshot extends DatabaseClusterNew {
731
749
public readonly clusterIdentifier : string ;
750
+ public readonly clusterResourceIdentifier : string ;
732
751
public readonly clusterEndpoint : Endpoint ;
733
752
public readonly clusterReadEndpoint : Endpoint ;
734
753
public readonly connections : ec2 . Connections ;
@@ -774,6 +793,7 @@ export class DatabaseClusterFromSnapshot extends DatabaseClusterNew {
774
793
} ) ;
775
794
776
795
this . clusterIdentifier = cluster . ref ;
796
+ this . clusterResourceIdentifier = cluster . attrDbClusterResourceId ;
777
797
778
798
if ( secret ) {
779
799
this . secret = secret . attach ( this ) ;
0 commit comments