Terraform: cannot traverse type VmwareDistributedVirtualSwitch

10/17/2017

Trying to setup kubernetes-anywhere for the first time, and I am having a challenge in getting terraform to use a distributed port group that I have setup in vCenter. The error message is:

* vsphere_virtual_machine.kubevm1: 1 error(s) occured:

* vsphere_virtual_machine.kubevm1: cannot traverse type VmwareDistributedVirtualSwitch

The pertinent terraform settings:

network_interface.#:                     "" => "1"
network_interface.0.ip_address:          "" => "<computed>"
network_interface.0.ipv4_address:        "" => "<computed>"
network_interface.0.ipv4_gateway:        "" => "<computed>"
network_interface.0.ipv4_prefix_length:  "" => "<computed>"
network_interface.0.ipv6_address:        "" => "<computed>"
network_interface.0.ipv6_gateway:        "" => "<computed>"
network_interface.0.ipv6_prefix_length:  "" => "<computed>"
network_interface.0.label:               "" => "Development/dvDevCluster/dvDHCP115"
network_interface.0.mac_address:         "" => "<computed>"
network_interface.0.subnet_mask:         "" => "<computed>"

Our vCenter's network inventory: distributed port group directory tree

We are trying to use the distributed port group dvDHCP115. Any help would be appreciated - I've spent way too long on this!

-- JoeAway
kubernetes
terraform
vcenter
vmware

1 Answer

10/18/2017

Found a solution:

Use the label "Development/dvDHCP115", not "Development/dvDevCluster/dvDHCP115"

Terraform does not appear to be able to handle the full path to the Port Group when it contains a Distributed Switch (e.g. dvDevCluster).

-- JoeAway
Source: StackOverflow