Adding host to DVS

I have the following terraform code:

data "vsphere_host" "host" {
  datacenter_id = "${}"
resource "vsphere_distributed_virtual_switch" "dvsa" {
  name          = "dspah"
  datacenter_id = "${}"

  uplinks         = ["tfup1"]
  active_uplinks  = ["tfup1"]
  host {
     host_system_id = "${}"
     //devices        = ["${var.network_interfaces}"]
     devices        = ["vmnic0","vmnic1"]

After terraform apply I get the following error:

│ Error: error waiting for DVS creation to complete: The operation is not supported on the object.
│   with vsphere_distributed_virtual_switch.dvsa,
│   on line 76, in resource "vsphere_distributed_virtual_switch" "dvsa":
│   76: resource "vsphere_distributed_virtual_switch" "dvsa" {

When I comment my host block , my error will be solved.

I need to introduce my ESXI to my DVS. It has a permanet IP address.
How can I introduce it?

NOTE: I do not want to create ESXI, I have it. I only want to introduce it.

I notice the same thing,I think this can be solved with a depends_on

1 Like