@@ -113,28 +113,6 @@ func (subnetBuilder *subnetModelBuilderImpl) validateSubnetsInput(subnetConfigsP
113
113
privateIPv4AllocationSpecified := subnetsConfig [0 ].PrivateIPv4Allocation != nil
114
114
sourceNATSpecified := subnetsConfig [0 ].SourceNatIPv6Prefix != nil
115
115
116
- for _ , subnetConfig := range subnetsConfig {
117
- if (subnetConfig .Identifier != "" ) != identifierSpecified {
118
- return false , errors .Errorf ("Either specify all subnet identifiers or none." )
119
- }
120
-
121
- if (subnetConfig .EIPAllocation != nil ) != eipAllocationSpecified {
122
- return false , errors .Errorf ("Either specify all eip allocations or none." )
123
- }
124
-
125
- if (subnetConfig .IPv6Allocation != nil ) != ipv6AllocationSpecified {
126
- return false , errors .Errorf ("Either specify all ipv6 allocations or none." )
127
- }
128
-
129
- if (subnetConfig .PrivateIPv4Allocation != nil ) != privateIPv4AllocationSpecified {
130
- return false , errors .Errorf ("Either specify all private ipv4 allocations or none." )
131
- }
132
-
133
- if (subnetConfig .SourceNatIPv6Prefix != nil ) != sourceNATSpecified {
134
- return false , errors .Errorf ("Either specify all source nat prefixes or none." )
135
- }
136
- }
137
-
138
116
if eipAllocationSpecified {
139
117
if subnetBuilder .loadBalancerType != elbv2model .LoadBalancerTypeNetwork {
140
118
return false , errors .Errorf ("EIP Allocation is only allowed for Network LoadBalancers" )
@@ -171,6 +149,28 @@ func (subnetBuilder *subnetModelBuilderImpl) validateSubnetsInput(subnetConfigsP
171
149
}
172
150
}
173
151
152
+ for _ , subnetConfig := range subnetsConfig {
153
+ if (subnetConfig .Identifier != "" ) != identifierSpecified {
154
+ return false , errors .Errorf ("Either specify all subnet identifiers or none." )
155
+ }
156
+
157
+ if (subnetConfig .EIPAllocation != nil ) != eipAllocationSpecified {
158
+ return false , errors .Errorf ("Either specify all eip allocations or none." )
159
+ }
160
+
161
+ if (subnetConfig .IPv6Allocation != nil ) != ipv6AllocationSpecified {
162
+ return false , errors .Errorf ("Either specify all ipv6 allocations or none." )
163
+ }
164
+
165
+ if (subnetConfig .PrivateIPv4Allocation != nil ) != privateIPv4AllocationSpecified {
166
+ return false , errors .Errorf ("Either specify all private ipv4 allocations or none." )
167
+ }
168
+
169
+ if (subnetConfig .SourceNatIPv6Prefix != nil ) != sourceNATSpecified {
170
+ return false , errors .Errorf ("Either specify all source nat prefixes or none." )
171
+ }
172
+ }
173
+
174
174
return sourceNATSpecified , nil
175
175
}
176
176
0 commit comments