Skip to content

Commit

Permalink
Fix #1707 (#1786)
Browse files Browse the repository at this point in the history
Check for nil before doing type conversion.
  • Loading branch information
macbutch authored Oct 6, 2023
1 parent 15408a3 commit 9012630
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions providers/aws/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ func (g *Ec2Generator) PostConvertHook() error {
if r.InstanceInfo.Type != "aws_instance" {
continue
}
if r.Item["root_block_device"] == nil {
continue
}

rootDeviceVolumeType := r.InstanceState.Attributes["root_block_device.0.volume_type"]
if !(rootDeviceVolumeType == "io1" || rootDeviceVolumeType == "io2" || rootDeviceVolumeType == "gp3") {
delete(r.Item["root_block_device"].([]interface{})[0].(map[string]interface{}), "iops")
Expand Down

0 comments on commit 9012630

Please sign in to comment.