@@ -190,6 +190,7 @@ export class ConvertAseaConfig {
190190 private readonly assumeRoleName : string ;
191191 private readonly writeFilesConfig : WriteToSourcesTypes . WriteToSourcesConfig ;
192192 private readonly ouToNestedOuMap : Map < string , Set < string > > = new Map ( ) ;
193+ private readonly appendVpcSuffixes : boolean ;
193194 private accounts : Account [ ] = [ ] ;
194195 private outputs : StackOutput [ ] = [ ] ;
195196 private vpcAssignedCidrs : VpcAssignedCidr [ ] = [ ] ;
@@ -213,6 +214,7 @@ export class ConvertAseaConfig {
213214 this . region = config . homeRegion ;
214215 this . centralBucketName = config . centralBucket ! ;
215216 this . aseaPrefix = config . aseaPrefix ! . endsWith ( '-' ) ? config . aseaPrefix ! : `${ config . aseaPrefix } -` ;
217+ this . appendVpcSuffixes = config . appendUniqueSuffixToVPCNames ?? false ;
216218 this . parametersTable = `${ this . aseaPrefix } Parameters` ;
217219 this . acceleratorName = config . acceleratorName ! ;
218220 this . sts = new STS ( ) ;
@@ -252,7 +254,7 @@ export class ConvertAseaConfig {
252254 this . subnetAssignedCidrs = await loadSubnetAssignedCidrs ( subnetsCidrsTableName ( this . aseaPrefix ) , this . dynamoDb ) ;
253255 this . outputs = await loadOutputs ( `${ this . aseaPrefix } Outputs` , this . dynamoDb ) ;
254256 this . globalOptions = aseaConfig [ 'global-options' ] ;
255- this . vpcConfigs = aseaConfig . getVpcConfigs ( ) ;
257+ this . vpcConfigs = aseaConfig . getVpcConfigs ( this . appendVpcSuffixes ) ;
256258 const regionsWithVpc = this . vpcConfigs . map ( ( resolvedConfig ) => resolvedConfig . vpcConfig . region ) ;
257259 this . regionsWithoutVpc = this . globalOptions [ 'supported-regions' ] . filter (
258260 ( region ) => ! regionsWithVpc . includes ( region ) ,
@@ -2988,7 +2990,7 @@ export class ConvertAseaConfig {
29882990 sourceVpcConfig = this . vpcConfigs . find ( ( { vpcConfig } ) => vpcConfig . name === source . vpc ) ;
29892991 }
29902992 if ( SecurityGroupSourceConfig . is ( source ) ) {
2991- lzaRule . sources . push ( {
2993+ lzaRule . sources . push ( {
29922994 securityGroups : source [ 'security-group' ] . map ( securityGroupName ) ,
29932995 } ) ;
29942996 } else if ( SubnetSourceConfig . is ( source ) ) {
@@ -3000,7 +3002,7 @@ export class ConvertAseaConfig {
30003002 ) ,
30013003 subnets : source . subnet . flatMap ( ( sourceSubnet ) =>
30023004 aseaConfig
3003- . getAzSubnets ( sourceVpcConfig ?. accountKey || source . account || accountKey || '' , source . vpc , sourceSubnet )
3005+ . getAzSubnets ( sourceVpcConfig ?. accountKey || source . account || accountKey || '' , source . vpc , sourceSubnet , this . appendVpcSuffixes )
30043006 . map ( ( s ) => createSubnetName ( source . vpc , s . subnetName , s . az ) ) ,
30053007 ) ,
30063008 vpc : sourceVpcConfig ?. lzaVpcName ?? source . vpc ,
@@ -3080,7 +3082,7 @@ export class ConvertAseaConfig {
30803082 target = {
30813083 account : destinationAccountKey ,
30823084 subnet : createSubnetName ( dest . vpc , ruleSubnet . subnetName , ruleSubnet . az ) ,
3083- vpc : createLzaVpcName ( destination , destinationAccountKey ! , vpcConfig . region ) ,
3085+ vpc : createLzaVpcName ( destination , destinationAccountKey ! , vpcConfig . region , this . appendVpcSuffixes ) ,
30843086 region : targetRegion ,
30853087 } ;
30863088 }
@@ -3227,7 +3229,7 @@ export class ConvertAseaConfig {
32273229 if ( inboundResolver ) {
32283230 lzaEndpointsConfig . push ( {
32293231 name : `${ vpcConfig . name } InboundEndpoint` ,
3230- vpc : createLzaVpcName ( vpcConfig . name , accountKey ! , vpcConfig . region ) ,
3232+ vpc : createLzaVpcName ( vpcConfig . name , accountKey ! , vpcConfig . region , this . appendVpcSuffixes ) ,
32313233 subnets :
32323234 vpcConfig . subnets
32333235 ?. find ( ( subnetItem ) => subnetItem . name === vpcConfig . resolvers ?. subnet )
@@ -3241,7 +3243,7 @@ export class ConvertAseaConfig {
32413243 if ( outboundResolver ) {
32423244 lzaEndpointsConfig . push ( {
32433245 name : `${ vpcConfig . name } OutboundEndpoint` ,
3244- vpc : createLzaVpcName ( vpcConfig . name , accountKey ! , vpcConfig . region ) ,
3246+ vpc : createLzaVpcName ( vpcConfig . name , accountKey ! , vpcConfig . region , this . appendVpcSuffixes ) ,
32453247 subnets :
32463248 vpcConfig . subnets
32473249 ?. find ( ( subnetItem ) => subnetItem . name === vpcConfig . resolvers ?. subnet )
@@ -3740,7 +3742,7 @@ export class ConvertAseaConfig {
37403742 return ipv4CidrBlock ;
37413743 }
37423744 private async createCloudFormationStacksForALBIpForwarding ( aseaConfig : AcceleratorConfig ) {
3743- const vpcs = aseaConfig . getVpcConfigs ( ) ;
3745+ const vpcs = aseaConfig . getVpcConfigs ( this . appendVpcSuffixes ) ;
37443746 const vpcMaps = [ ] ;
37453747 for ( const vpc of vpcs ) {
37463748 if ( vpc . vpcConfig [ 'alb-forwarding' ] ) {
0 commit comments