Better readable modification assigning of PrivateIPv4Address

This commit is contained in:
Alexander Block 2021-02-10 09:39:32 +01:00
parent 2c0f9809eb
commit 295fb11ac2
1 changed files with 6 additions and 4 deletions

View File

@ -72,12 +72,14 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error {
if subnet.Name == clusterSubnet.Name { if subnet.Name == clusterSubnet.Name {
elbSubnet := b.LinkToSubnet(&clusterSubnet) elbSubnet := b.LinkToSubnet(&clusterSubnet)
elbSubnets = append(elbSubnets, elbSubnet) elbSubnets = append(elbSubnets, elbSubnet)
nlbSubnetMappings = append(nlbSubnetMappings, &awstasks.SubnetMapping{
nlbSubnetMapping := &awstasks.SubnetMapping{
Subnet: elbSubnet, Subnet: elbSubnet,
})
if subnet.PrivateIPv4Address != nil {
nlbSubnetMappings[len(nlbSubnetMappings)-1].PrivateIPv4Address = subnet.PrivateIPv4Address
} }
if subnet.PrivateIPv4Address != nil {
nlbSubnetMapping.PrivateIPv4Address = subnet.PrivateIPv4Address
}
nlbSubnetMappings = append(nlbSubnetMappings, nlbSubnetMapping)
break break
} }
} }