Skip to content

Commit

Permalink
service/ec2: Prevent crash with ENI attachments missing DeviceIndex o…
Browse files Browse the repository at this point in the history
…r AttachmentID (#15567)

Added nil checks on network interface attachment id/device index
  • Loading branch information
essien-cobham authored Nov 9, 2020
1 parent 05a856f commit b1615b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aws/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,12 @@ func flattenAttachment(a *ec2.NetworkInterfaceAttachment) map[string]interface{}
if a.InstanceId != nil {
att["instance"] = *a.InstanceId
}
att["device_index"] = *a.DeviceIndex
att["attachment_id"] = *a.AttachmentId
if a.DeviceIndex != nil {
att["device_index"] = *a.DeviceIndex
}
if a.AttachmentId != nil {
att["attachment_id"] = *a.AttachmentId
}
return att
}

Expand Down

0 comments on commit b1615b1

Please sign in to comment.