File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
core/runtime/src/create-adconnector
deployments/cdk/src/deployments/mad Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,18 @@ export const handler = async (input: AdConnectorInput) => {
113113 }
114114
115115 // Find subnets based on ADC Config subnet name
116- const subnetIds = vpcOutput . subnets . filter ( s => s . subnetName === adcConfig . subnet ) . map ( s => s . subnetId ) ;
116+ let subnetIds : string [ ] ;
117+ if ( adcConfig . azs . length > 0 ) {
118+ const adcAzs = adcConfig . azs . slice ( 0 , 2 ) ;
119+ subnetIds = vpcOutput . subnets
120+ . filter ( s => s . subnetName === adcConfig . subnet && adcAzs . includes ( s . az ) )
121+ . map ( s => s . subnetId ) ;
122+ } else {
123+ subnetIds = vpcOutput . subnets
124+ . filter ( s => s . subnetName === adcConfig . subnet )
125+ . map ( s => s . subnetId )
126+ . slice ( 0 , 2 ) ;
127+ }
117128
118129 const accountId = getAccountId ( accounts , accountKey ) ;
119130 if ( ! accountId ) {
Original file line number Diff line number Diff line change @@ -62,7 +62,18 @@ function createActiveDirectory(props: MadStep2Props) {
6262 }
6363
6464 const vpcId = vpcOutput . vpcId ;
65- const subnetIds = vpcOutput . subnets . filter ( s => s . subnetName === madConfig . subnet ) . map ( s => s . subnetId ) ;
65+ let subnetIds : string [ ] ;
66+ if ( madConfig . azs . length > 0 ) {
67+ const madAzs = madConfig . azs . slice ( 0 , 2 ) ;
68+ subnetIds = vpcOutput . subnets
69+ . filter ( s => s . subnetName === madConfig . subnet && madAzs . includes ( s . az ) )
70+ . map ( s => s . subnetId ) ;
71+ } else {
72+ subnetIds = vpcOutput . subnets
73+ . filter ( s => s . subnetName === madConfig . subnet )
74+ . map ( s => s . subnetId )
75+ . slice ( 0 , 2 ) ;
76+ }
6677
6778 const madPasswordSecretArn = getMadConfigRootPasswordSecretArn ( {
6879 acceleratorPrefix,
Original file line number Diff line number Diff line change @@ -338,6 +338,7 @@ export const MadConfigType = t.interface({
338338 'vpc-name' : t . string ,
339339 region : t . string ,
340340 subnet : t . string ,
341+ azs : fromNullable ( t . array ( t . string ) , [ ] ) ,
341342 size : t . string ,
342343 'dns-domain' : t . string ,
343344 'netbios-domain' : t . string ,
@@ -448,6 +449,7 @@ export const AdcConfigType = t.interface({
448449 deploy : t . boolean ,
449450 'vpc-name' : t . string ,
450451 subnet : t . string ,
452+ azs : fromNullable ( t . array ( t . string ) , [ ] ) ,
451453 size : t . string ,
452454 restrict_srcips : t . array ( cidr ) ,
453455 'connect-account-key' : t . string ,
You can’t perform that action at this time.
0 commit comments