vSphere resource to assign/migrate vmk0 VMKernel adapter to distributed switch port group

Hello,

I was trying to create distributed switch and migrate the vmk0 (standard switch) vmkernel adapter to Distributed switch.
I could create distributed switch but migrating/assigning the vmkernel adapter to distributed port group isn’t happening.

My environment has vmnic0 and vmnic1 with same network. vSwitch0 is assigned to vmnic0 which also has vmk0(VMKernel adapter) for “Management Network”.
Creating the vsphere distributed switch using vmnic1 to add/manage esxi host works via terraform, however, couldn’t find an resource to migrate/assign distributed port group to the vmk0. Could you please help?

Terraform import helped us in migrating the vmk0 from vss to vds.
attachment is detailed migration of vss to vds.

step1 does the addition of DSwitch, DPorts, Migrating and fetching the details of vswith0 to be destroyed.

steps to follow for step1: terraform init
terraform plan
terraform import vsphere_vnic.v1[“host-system-id”] host-system-id_vmk0
terraform import vsphere_host_virtual_switch.switch[“host-system-id”] tf-HostVirtualSwitch:host-system-id:vSwitch0
terraform apply

step2
migrating the second vmnic(physical adapter from vss to vds) and destroying the vswitch0

steps to follow for step2: terraform plan
terraform apply

Note: makesure you maintain the same terraform state of step1 for step2.

step1.txt (2.7 KB)
Uploading: variables.txt…

step2.txt (2.3 KB)

I found this helpful topic, but I cannot make it work. After Step 1 my vmk0 is not migrated. I just got a new vmk2 added to my hosts, attached correctly to the new port group, and VDS, but the old vmk0 is still there attached to vSwitch0 VSS.

I guess the problem is with the imports, but cannot find it. Any help?

Thanks