In my main.tf
I created 1 VM and 2 DPG and one DS.
I need to tell my NICes of my VM have to member of PortGroup.
How can I do it?
Such as:
Not sure which pieces you already have within terraform.
Unfortunately the vsphere providers lacks a data source for the port group. So you’d have to hardcode it or manage it within terraform.
resource "vsphere_virtual_machine" "vmFromRemoteOvf" {
name = "terravm1"
datacenter_id = vsphere_datacenter.dc1.moid
<snip>
network_interface {
network_id = "id_of_portgroup_1"
}
network_interface {
network_id = "id_of_portgroup_2"
}
<snip>
}
I can create VM without any problem, But when I use:
network_interface{
network_id = vsphere_distributed_port_group.pg_majd_mgm.id
}
Then I get the following message for VM:
╷
│ Error: error reconfiguring virtual machine: error reconfiguring virtual machine: A specified parameter was not correct: spec.deviceChange.device.port.switchUuid
│
│
│ with vsphere_virtual_machine.vm_majd,
│ on main.tf line 97, in resource "vsphere_virtual_machine" "vm_majd":
│ 97: resource "vsphere_virtual_machine" "vm_majd" {
│