diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aa945699..b7e236d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ BUG FIXES: * resources/opennebula_datastore: conditional reading of `datastore` argument from `custom`. (#382) * resources/opennebula_virtual_network_address_range: modify `hold_ips` content reading and introduce `helds_ips` attribute (#397) * resources/opennebula_virtual_network: for reservation, fix `type` and `reservation_ar_id` reading. (#397) +* resources/opennebula_host: set overcommit map only when not empty (#399) DEPRECATION: diff --git a/opennebula/resource_opennebula_host.go b/opennebula/resource_opennebula_host.go index 9c211b419..c32d33892 100644 --- a/opennebula/resource_opennebula_host.go +++ b/opennebula/resource_opennebula_host.go @@ -343,7 +343,9 @@ func resourceOpennebulaHostRead(ctx context.Context, d *schema.ResourceData, met overcommitMap["memory"] = hostInfos.Share.TotalMem - reservedMem } - d.Set("overcommit", []map[string]interface{}{overcommitMap}) + if len(overcommitMap) > 0 { + d.Set("overcommit", []map[string]interface{}{overcommitMap}) + } } clusterID := d.Get("cluster_id").(int)