File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed
lib/cdk-accelerator/src/core Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ export const handler = async (input: StoreStackOutputInput) => {
4040 console . warn ( `Could not load stack with name "${ summary . StackName } "` ) ;
4141 continue ;
4242 }
43- const acceleratorTag = stack . Tags ?. find ( t => t . Key === 'Accelerator ' ) ;
43+ const acceleratorTag = stack . Tags ?. find ( t => t . Key === 'AcceleratorName ' ) ;
4444 if ( ! acceleratorTag ) {
45- console . warn ( `Could not find Accelerator tag in stack with name "${ summary . StackName } "` ) ;
45+ console . warn ( `Could not find AcceleratorName tag in stack with name "${ summary . StackName } "` ) ;
4646 continue ;
4747 }
4848
Original file line number Diff line number Diff line change 152152 "preset" : " ts-jest" ,
153153 "testEnvironment" : " node" ,
154154 "testMatch" : [
155- " <rootDir>/test/**/(*.)+ (spec|test).ts "
155+ " <rootDir>/test/**/* (*.)@ (spec|test).[t]s?(x) "
156156 ]
157157 }
158158}
Original file line number Diff line number Diff line change @@ -302,7 +302,8 @@ function tagsForStack(stack: CloudFormationStackArtifact): Tag[] {
302302 // unfortunately.
303303 x => toCloudFormationTags ( x . data as cxschema . Tag [ ] ) ,
304304 ) ;
305- return Array . prototype . concat ( [ ] , ...tagLists ) ;
305+ // Conditional operator to remove undefined (Will get for Accelerator)
306+ return Array . prototype . concat ( [ ] , tagLists . length > 0 ? tagLists [ 0 ] . filter ( t => ! ! t ) : [ ] ) ;
306307}
307308
308309/**
@@ -312,5 +313,10 @@ function tagsForStack(stack: CloudFormationStackArtifact): Tag[] {
312313 * to the way that CloudFormation expects them. (Different casing).
313314 */
314315function toCloudFormationTags ( tags : cxschema . Tag [ ] ) : Tag [ ] {
315- return tags . map ( t => ( { Key : t . key , Value : t . value } ) ) ;
316+ return tags . map ( t => {
317+ // Ignoring Accelerator tag in CFN since that is duplicated
318+ if ( t . key !== 'Accelerator' ) {
319+ return { Key : t . key , Value : t . value } ;
320+ }
321+ } ) ;
316322}
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ export class AcceleratorStack extends cdk.Stack {
1616 this . acceleratorName = props . acceleratorName ;
1717 this . acceleratorPrefix = props . acceleratorPrefix ;
1818
19+ // Add Stack level tags using this.tags, so that CDK won't add them to resource in CFN
20+ this . tags . setTag ( 'AcceleratorName' , this . acceleratorName ) ;
1921 cdk . Aspects . of ( this ) . add ( new cdk . Tag ( 'Accelerator' , this . acceleratorName ) ) ;
2022 cdk . Aspects . of ( this ) . add ( new AcceleratorNameTagger ( ) ) ;
2123 cdk . Aspects . of ( this ) . add ( new AcceleratorProtectedTagger ( this . acceleratorName ) ) ;
You can’t perform that action at this time.
0 commit comments