fix: use copy builtin correctly for security groups
@@ -608,8 +608,8 @@ func (s *Service) attachSecurityGroupsToNetworkInterface(groups []string, interf
return errors.Wrapf(err, "failed to look up network interface security groups: %+v", err)
}
- var totalGroups []string
- copy(existingGroups, totalGroups)
+ totalGroups := make([]string, len(existingGroups))
+ copy(totalGroups, existingGroups)
for _, group := range groups {
if !util.Contains(existingGroups, group) {
@@ -622,6 +622,8 @@ func (s *Service) attachSecurityGroupsToNetworkInterface(groups []string, interf
return nil
}
+ s.scope.V(3).Info("updating security groups", "groups", totalGroups)
+
input := &ec2.ModifyNetworkInterfaceAttributeInput{
NetworkInterfaceId: aws.String(interfaceID),
Groups: aws.StringSlice(totalGroups),
