Skip to content

Commit eaa3eca

Browse files
authored
Merge pull request #4362 from enxebre/fix-security-groups
Pass right SGs for IsExternallyManaged on creation
2 parents 0ca6090 + 72fabb7 commit eaa3eca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/cloud/services/ec2/instances.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,14 @@ func (s *Service) getFilteredSubnets(criteria ...*ec2.Filter) ([]*ec2.Subnet, er
401401
// They are considered "core" to its proper functioning.
402402
func (s *Service) GetCoreSecurityGroups(scope *scope.MachineScope) ([]string, error) {
403403
if scope.IsExternallyManaged() {
404-
return nil, nil
404+
ids := make([]string, 0)
405+
for _, sg := range scope.AWSMachine.Spec.AdditionalSecurityGroups {
406+
if sg.ID == nil {
407+
continue
408+
}
409+
ids = append(ids, *sg.ID)
410+
}
411+
return ids, nil
405412
}
406413

407414
// These are common across both controlplane and node machines

0 commit comments

Comments
 (0)