@@ -105,28 +105,6 @@ func (subnetBuilder *subnetModelBuilderImpl) validateSubnetsInput(subnetConfigsP
105105 privateIPv4AllocationSpecified := subnetsConfig [0 ].PrivateIPv4Allocation != nil
106106 sourceNATSpecified := subnetsConfig [0 ].SourceNatIPv6Prefix != nil
107107
108- for _ , subnetConfig := range subnetsConfig {
109- if (subnetConfig .Identifier != "" ) != identifierSpecified {
110- return false , errors .Errorf ("Either specify all subnet identifiers or none." )
111- }
112-
113- if (subnetConfig .EIPAllocation != nil ) != eipAllocationSpecified {
114- return false , errors .Errorf ("Either specify all eip allocations or none." )
115- }
116-
117- if (subnetConfig .IPv6Allocation != nil ) != ipv6AllocationSpecified {
118- return false , errors .Errorf ("Either specify all ipv6 allocations or none." )
119- }
120-
121- if (subnetConfig .PrivateIPv4Allocation != nil ) != privateIPv4AllocationSpecified {
122- return false , errors .Errorf ("Either specify all private ipv4 allocations or none." )
123- }
124-
125- if (subnetConfig .SourceNatIPv6Prefix != nil ) != sourceNATSpecified {
126- return false , errors .Errorf ("Either specify all source nat prefixes or none." )
127- }
128- }
129-
130108 if eipAllocationSpecified {
131109 if subnetBuilder .loadBalancerType != elbv2model .LoadBalancerTypeNetwork {
132110 return false , errors .Errorf ("EIP Allocation is only allowed for Network LoadBalancers" )
@@ -163,6 +141,28 @@ func (subnetBuilder *subnetModelBuilderImpl) validateSubnetsInput(subnetConfigsP
163141 }
164142 }
165143
144+ for _ , subnetConfig := range subnetsConfig {
145+ if (subnetConfig .Identifier != "" ) != identifierSpecified {
146+ return false , errors .Errorf ("Either specify all subnet identifiers or none." )
147+ }
148+
149+ if (subnetConfig .EIPAllocation != nil ) != eipAllocationSpecified {
150+ return false , errors .Errorf ("Either specify all eip allocations or none." )
151+ }
152+
153+ if (subnetConfig .IPv6Allocation != nil ) != ipv6AllocationSpecified {
154+ return false , errors .Errorf ("Either specify all ipv6 allocations or none." )
155+ }
156+
157+ if (subnetConfig .PrivateIPv4Allocation != nil ) != privateIPv4AllocationSpecified {
158+ return false , errors .Errorf ("Either specify all private ipv4 allocations or none." )
159+ }
160+
161+ if (subnetConfig .SourceNatIPv6Prefix != nil ) != sourceNATSpecified {
162+ return false , errors .Errorf ("Either specify all source nat prefixes or none." )
163+ }
164+ }
165+
166166 return sourceNATSpecified , nil
167167}
168168
0 commit comments