Skip to content

Commit 9012630

Browse files
author
Mark Butcher
authored
Check for nil before doing type conversion.
1 parent 15408a3 commit 9012630

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

providers/aws/ec2.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ func (g *Ec2Generator) PostConvertHook() error {
9494
if r.InstanceInfo.Type != "aws_instance" {
9595
continue
9696
}
97+
if r.Item["root_block_device"] == nil {
98+
continue
99+
}
100+
97101
rootDeviceVolumeType := r.InstanceState.Attributes["root_block_device.0.volume_type"]
98102
if !(rootDeviceVolumeType == "io1" || rootDeviceVolumeType == "io2" || rootDeviceVolumeType == "gp3") {
99103
delete(r.Item["root_block_device"].([]interface{})[0].(map[string]interface{}), "iops")

0 commit comments

Comments
 (0)