@@ -131,7 +131,7 @@ export class AwsSolutionAspect implements cdk.IAspect {
131
131
// 1. Some resources do not support tag updates
132
132
// 2. Using Aspects for stacks that use the fs.writeFileSync() operation
133
133
// causes the application to quit during stack synthesis
134
- function addAcceleratorTags ( node : IConstruct ) : void {
134
+ function addAcceleratorTags ( node : IConstruct , partition : string ) : void {
135
135
// Current accelerator prefix is static
136
136
const acceleratorPrefix = 'AWSAccelerator' ;
137
137
@@ -145,6 +145,9 @@ function addAcceleratorTags(node: IConstruct): void {
145
145
146
146
for ( const resource of node . node . findAll ( ) ) {
147
147
if ( resource instanceof cdk . CfnResource && ! excludeResourceTypes . includes ( resource . cfnResourceType ) ) {
148
+ if ( resource instanceof cdk . aws_ec2 . CfnTransitGateway && partition !== 'aws' ) {
149
+ continue ;
150
+ }
148
151
new cdk . Tag ( 'Accel-P' , acceleratorPrefix ) . visit ( resource ) ;
149
152
new cdk . Tag ( 'Accelerator' , acceleratorPrefix ) . visit ( resource ) ;
150
153
}
@@ -349,7 +352,7 @@ async function main() {
349
352
...props ,
350
353
} ,
351
354
) ;
352
- addAcceleratorTags ( prepareStack ) ;
355
+ addAcceleratorTags ( prepareStack , partition ) ;
353
356
cdk . Aspects . of ( prepareStack ) . add ( new AwsSolutionsChecks ( ) ) ;
354
357
}
355
358
@@ -377,7 +380,7 @@ async function main() {
377
380
...props ,
378
381
} ,
379
382
) ;
380
- addAcceleratorTags ( finalizeStack ) ;
383
+ addAcceleratorTags ( finalizeStack , partition ) ;
381
384
cdk . Aspects . of ( finalizeStack ) . add ( new AwsSolutionsChecks ( ) ) ;
382
385
}
383
386
@@ -405,7 +408,7 @@ async function main() {
405
408
...props ,
406
409
} ,
407
410
) ;
408
- addAcceleratorTags ( accountsStack ) ;
411
+ addAcceleratorTags ( accountsStack , partition ) ;
409
412
cdk . Aspects . of ( accountsStack ) . add ( new AwsSolutionsChecks ( ) ) ;
410
413
}
411
414
@@ -436,7 +439,7 @@ async function main() {
436
439
...props ,
437
440
} ,
438
441
) ;
439
- addAcceleratorTags ( organizationStack ) ;
442
+ addAcceleratorTags ( organizationStack , partition ) ;
440
443
cdk . Aspects . of ( organizationStack ) . add ( new AwsSolutionsChecks ( ) ) ;
441
444
}
442
445
}
@@ -478,7 +481,7 @@ async function main() {
478
481
...props ,
479
482
} ,
480
483
) ;
481
- addAcceleratorTags ( keyStack ) ;
484
+ addAcceleratorTags ( keyStack , partition ) ;
482
485
cdk . Aspects . of ( keyStack ) . add ( new AwsSolutionsChecks ( ) ) ;
483
486
}
484
487
@@ -505,7 +508,7 @@ async function main() {
505
508
...props ,
506
509
} ,
507
510
) ;
508
- addAcceleratorTags ( auditStack ) ;
511
+ addAcceleratorTags ( auditStack , partition ) ;
509
512
cdk . Aspects . of ( auditStack ) . add ( new AwsSolutionsChecks ( ) ) ;
510
513
}
511
514
}
@@ -547,7 +550,7 @@ async function main() {
547
550
...props ,
548
551
} ,
549
552
) ;
550
- addAcceleratorTags ( bootstrapStack ) ;
553
+ addAcceleratorTags ( bootstrapStack , partition ) ;
551
554
cdk . Aspects . of ( bootstrapStack ) . add ( new AwsSolutionsChecks ( ) ) ;
552
555
}
553
556
@@ -566,7 +569,7 @@ async function main() {
566
569
...props ,
567
570
} ,
568
571
) ;
569
- addAcceleratorTags ( loggingStack ) ;
572
+ addAcceleratorTags ( loggingStack , partition ) ;
570
573
cdk . Aspects . of ( loggingStack ) . add ( new AwsSolutionsChecks ( ) ) ;
571
574
}
572
575
@@ -585,7 +588,7 @@ async function main() {
585
588
...props ,
586
589
} ,
587
590
) ;
588
- addAcceleratorTags ( securityStack ) ;
591
+ addAcceleratorTags ( securityStack , partition ) ;
589
592
cdk . Aspects . of ( securityStack ) . add ( new AwsSolutionsChecks ( ) ) ;
590
593
}
591
594
@@ -604,7 +607,7 @@ async function main() {
604
607
...props ,
605
608
} ,
606
609
) ;
607
- addAcceleratorTags ( operationsStack ) ;
610
+ addAcceleratorTags ( operationsStack , partition ) ;
608
611
cdk . Aspects . of ( operationsStack ) . add ( new AwsSolutionsChecks ( ) ) ;
609
612
}
610
613
@@ -623,7 +626,7 @@ async function main() {
623
626
...props ,
624
627
} ,
625
628
) ;
626
- addAcceleratorTags ( networkPrepStack ) ;
629
+ addAcceleratorTags ( networkPrepStack , partition ) ;
627
630
cdk . Aspects . of ( networkPrepStack ) . add ( new AwsSolutionsChecks ( ) ) ;
628
631
}
629
632
@@ -644,7 +647,7 @@ async function main() {
644
647
...props ,
645
648
} ,
646
649
) ;
647
- addAcceleratorTags ( securityResourcesStack ) ;
650
+ addAcceleratorTags ( securityResourcesStack , partition ) ;
648
651
cdk . Aspects . of ( securityResourcesStack ) . add ( new AwsSolutionsChecks ( ) ) ;
649
652
}
650
653
@@ -742,7 +745,7 @@ async function main() {
742
745
...props ,
743
746
} ,
744
747
) ;
745
- addAcceleratorTags ( vpcStack ) ;
748
+ addAcceleratorTags ( vpcStack , partition ) ;
746
749
cdk . Aspects . of ( vpcStack ) . add ( new AwsSolutionsChecks ( ) ) ;
747
750
748
751
const endpointsStack = new NetworkVpcEndpointsStack (
@@ -756,7 +759,7 @@ async function main() {
756
759
...props ,
757
760
} ,
758
761
) ;
759
- addAcceleratorTags ( endpointsStack ) ;
762
+ addAcceleratorTags ( endpointsStack , partition ) ;
760
763
endpointsStack . addDependency ( vpcStack ) ;
761
764
cdk . Aspects . of ( endpointsStack ) . add ( new AwsSolutionsChecks ( ) ) ;
762
765
@@ -771,7 +774,7 @@ async function main() {
771
774
...props ,
772
775
} ,
773
776
) ;
774
- addAcceleratorTags ( dnsStack ) ;
777
+ addAcceleratorTags ( dnsStack , partition ) ;
775
778
dnsStack . addDependency ( endpointsStack ) ;
776
779
cdk . Aspects . of ( dnsStack ) . add ( new AwsSolutionsChecks ( ) ) ;
777
780
}
@@ -793,7 +796,7 @@ async function main() {
793
796
...props ,
794
797
} ,
795
798
) ;
796
- addAcceleratorTags ( networkAssociationsStack ) ;
799
+ addAcceleratorTags ( networkAssociationsStack , partition ) ;
797
800
cdk . Aspects . of ( networkAssociationsStack ) . add ( new AwsSolutionsChecks ( ) ) ;
798
801
799
802
const networkGwlbStack = new NetworkAssociationsGwlbStack (
@@ -807,7 +810,7 @@ async function main() {
807
810
...props ,
808
811
} ,
809
812
) ;
810
- addAcceleratorTags ( networkGwlbStack ) ;
813
+ addAcceleratorTags ( networkGwlbStack , partition ) ;
811
814
cdk . Aspects . of ( networkGwlbStack ) . add ( new AwsSolutionsChecks ( ) ) ;
812
815
}
813
816
}
0 commit comments