Fix SecurityGroup check when there are no Network Interfaces associated with a LaunchTemplate

This commit is contained in:
Kashif Saadat 2020-03-03 16:53:33 +00:00
parent 564547fced
commit 697f4610c6
1 changed files with 3 additions and 1 deletions

View File

@ -1205,7 +1205,9 @@ func FindAutoScalingLaunchTemplateConfigurations(cloud fi.Cloud, securityGroups
for _, j := range req.LaunchTemplateVersions {
// @check if the security group references the security group above
var s []*string
s = append(s, j.LaunchTemplateData.NetworkInterfaces[0].Groups...)
if len(j.LaunchTemplateData.NetworkInterfaces) > 0 {
s = append(s, j.LaunchTemplateData.NetworkInterfaces[0].Groups...)
}
s = append(s, j.LaunchTemplateData.SecurityGroupIds...)
for _, y := range s {
if securityGroups.Has(fi.StringValue(y)) {