diff --git a/packer/data_source_json.go b/packer/data_source_json.go index 5a2445e..6f0fd78 100644 --- a/packer/data_source_json.go +++ b/packer/data_source_json.go @@ -428,7 +428,7 @@ func dataSourceJSONRead(d *schema.ResourceData, meta interface{}) error { } for f := range t { - if FlattenNames[f] && t[f] != nil { + if FlattenNames[f] && t[f] != nil && len(t[f].([]interface{})) != 0 { tempBlock := t[f].([]interface{})[0] t[f] = tempBlock } else if SpecialNames[f] && len(t[f].([]interface{})) != 0 && BlockNames[f] {