Skip to content

Commit 443f07d

Browse files
Seperate ipv6 permissions from ipv4
1 parent a37776d commit 443f07d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

internal/alb/sg/association.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,31 @@ func (c *associationController) reconcileLbSG(ctx context.Context, ingressKey ty
145145
Description: aws.String(fmt.Sprintf("Allow ingress on port %v from %v", port, cidr)),
146146
})
147147
}
148+
148149
ipv6Ranges := make([]*ec2.Ipv6Range, 0, len(cfg.LbInboundV6CIDRs))
149150
for _, cidr := range cfg.LbInboundV6CIDRs {
150151
ipv6Ranges = append(ipv6Ranges, &ec2.Ipv6Range{
151152
CidrIpv6: aws.String(cidr),
152153
Description: aws.String(fmt.Sprintf("Allow ingress on port %v from %v", port, cidr)),
153154
})
154155
}
156+
157+
if len(ipv6Ranges) > 0 {
158+
inboundPermissions = append(inboundPermissions, &ec2.IpPermission{
159+
IpProtocol: aws.String("tcp"),
160+
FromPort: aws.Int64(port),
161+
ToPort: aws.Int64(port),
162+
Ipv6Ranges: ipv6Ranges,
163+
})
164+
}
165+
155166
permission := &ec2.IpPermission{
156167
IpProtocol: aws.String("tcp"),
157168
FromPort: aws.Int64(port),
158169
ToPort: aws.Int64(port),
159170
IpRanges: ipRanges,
160-
Ipv6Ranges: ipv6Ranges,
161171
}
172+
162173
inboundPermissions = append(inboundPermissions, permission)
163174
}
164175
if err := c.sgController.Reconcile(ctx, sgInstance, inboundPermissions, sgTags); err != nil {

0 commit comments

Comments
 (0)