File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
packages/aws-cdk-lib/aws-ec2/lib Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1767,7 +1767,7 @@ export class Vpc extends VpcBase {
1767
1767
} ,
1768
1768
) ) ) ;
1769
1769
1770
- const { allocatedSubnets } = this . ipAddresses . allocateSubnetsCidr ( {
1770
+ let { allocatedSubnets } = this . ipAddresses . allocateSubnetsCidr ( {
1771
1771
vpcCidr : this . vpcCidrBlock ,
1772
1772
requestedSubnets,
1773
1773
} ) ;
@@ -1795,9 +1795,13 @@ export class Vpc extends VpcBase {
1795
1795
ipv6Cidrs : subnetIpv6Cidrs ,
1796
1796
} ) ;
1797
1797
1798
- // call the create function with the updated allocated subnet list
1799
- this . createSubnetResources ( requestedSubnets , allocatedSubnetsIpv6 . allocatedSubnets ) ;
1798
+ // assign allocated subnets to list with IPv6 addresses
1799
+ allocatedSubnets = allocatedSubnetsIpv6 . allocatedSubnets ;
1800
+ }
1801
+
1802
+ this . createSubnetResources ( requestedSubnets , allocatedSubnets ) ;
1800
1803
1804
+ if ( this . useIpv6 ) {
1801
1805
// add dependencies
1802
1806
( this . publicSubnets as PublicSubnet [ ] ) . forEach ( publicSubnet => {
1803
1807
if ( this . ipv6CidrBlock !== undefined ) {
@@ -1809,11 +1813,7 @@ export class Vpc extends VpcBase {
1809
1813
privateSubnet . node . addDependency ( this . ipv6CidrBlock ) ;
1810
1814
}
1811
1815
} ) ;
1812
- } else {
1813
- // keep default behavior without IPv6 CIDRs if not using IPv6
1814
- this . createSubnetResources ( requestedSubnets , allocatedSubnets ) ;
1815
1816
}
1816
-
1817
1817
}
1818
1818
1819
1819
/**
You can’t perform that action at this time.
0 commit comments