Optionally set a vsphere_host for a virtual machine


I’m using a terraform module that creates virtual machines (vsphere_virtual_machine resource). I see that normally terraform assigns virtual machines to the available hosts somewhat randomly (which I normally prefer), but I also sometimes need to pin certain virtual machines to certain esxi nodes. In order to do that, I know there’s host_system_id = data.vsphere_host.host.id, which I use together with:

data "vsphere_host" "datacenter" {
        name = var.esxi_host
        datacenter_id = data.vsphere_datacenter.datacenter.id

Could I configure it in such a way so that host_system_id is taken into consideration only when I define it explicitly? So for most virtual machines I just want that terraform randomly assigns virtual machines to the esxi nodes, but for some I’d like it to be pinned to these esxi hosts. Could I do that while still using the somewhat drier way (i.e. module)?