While I try to create VM in vSphere, ends up with error as
"Error: network_interface.0:Could not find network with ID “management Network ID”
Attached error for reference
Though we gave the exact Id, issue persists.
Can some one please assist on this…
Hey,
How did you create the virtual_machine in TF and how was the value specified ? is it a referenced value ?
Asking so that at least someone who knows vSphere might be able to help you out.
terraform {
required_providers {
vsphere = {
source = “hashicorp/vsphere”
version = “2.4.2”
}
}
}
provider “vsphere” {
user = “”
password = "
vsphere_server = “”
If you have a self-signed cert
allow_unverified_ssl = true
}
data “vsphere_datacenter” “dc” {
name = “dc1”
}
data “vsphere_datastore” “datastore” {
name = “datastore1”
datacenter_id = “${data.vsphere_datacenter.dc.id}”
}
data “vsphere_resource_pool” “pool” {
name = “esxi1/Resources”
datacenter_id = “${data.vsphere_datacenter.dc.id}”
}
data “vsphere_network” “network” {
name = “Public Network”
datacenter_id = “${data.vsphere_datacenter.dc.id}”
}
resource “vsphere_virtual_machine” “vm” {
name = “Ubuntu-OS”
resource_pool_id = “{data.vsphere_resource_pool.pool.id}"
datastore_id = "{data.vsphere_datastore.datastore.id}”
num_cpus = 1
memory = 1024
guest_id = “ubuntu64Guest”
ignored_guest_ips =
network_interface {
network_id = “${data.vsphere_network.network.id}”
}
disk {
label = “disk0”
size = 20
}
cdrom {
datastore_id = “${data.vsphere_datastore.datastore.id}”
path = “ubuntu-16.04.6-server-amd64.iso”
}
}