My scenario and implementing in Terraform

I decide to explain all of my scenario:
I have a Host and I don’t have to create it. with h.h.h.h address.
I have to create the following things:
two port group
3 VM

My VMs have 2 type interface:

  1. VM Network
  2. My Portgroups

I can’t assign my interfaces to PG. Because I have to assign my DS to my host h.h.h.h.
help me to assign everythin is needed.
You make me happy if help me…

Can you use a data source to get the ID of the pre-created host (code was not validated)?

locals {
  xxxdevices = ["vmnic1"]
data "vsphere_datacenter" "vsdc" {
  name = "myvsdc"

data "vsphere_host" "lovelyhost" { 
  name = ""
  datacenter_id =

resource "vsphere_distributed_virtual_switch" "mydvs" {
  name          = "dvsname"
  datacenter_id = "${}"
  max_mtu       = 9000

  host {
    host_system_id =
    devices = local.xxdevices


resource "vsphere_distributed_port_group" "management" {
  name                            = "mgt-pg"
  distributed_virtual_switch_uuid =

  vlan_id = 1222