I am new to Terraform and I am tying to create a VM using terraform. Below is my code. I want to clone a VM and don't want to give an IP. The VM gets created in vSphere but terraform kept on waiting for IP. Is there any way I can stop terraform to stop waiting for an ip?
Below is my code..
provider "vsphere" {
user = var.vsphere_user
password = var.vsphere_pass
vsphere_server = var.vsphere_server
allow_unverified_ssl = true
}
#Creating the data for resource
data "vsphere_datacenter" "dc" {
name = var.vsphere_datacenter
}
data "vsphere_datastore_cluster" "datastore_cluster" {
name = var.datastore_cluster
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_datastore" "datastore" {
name = var.vsphere_datastore
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_resource_pool" "pool" {
name = "RHEL IMAGES"
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_network" "network" {
name = var.network
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_virtual_machine" "template" {
name = var.vmtemp
datacenter_id = data.vsphere_datacenter.dc.id
}
resource "vsphere_virtual_machine" "vm" {
# count = var.instances
name = var.vmname
num_cpus = var.cpu_number
memory = var.ram_size
resource_pool_id = data.vsphere_resource_pool.pool.id
guest_id = data.vsphere_virtual_machine.template.guest_id
network_interface {
network_id = data.vsphere_network.network.id
adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
}
disk {
label = "disk0"
size = 140
}
clone {
template_uuid = data.vsphere_virtual_machine.template.id
customize {
linux_options {
host_name = var.vmname
domain = "development.test"
}
network_interface {
ipv4_address = ""
ipv4_netmask = 0
}
}
}
}
I have tried the below options and it doesn't work.. Can anyone please help me on this ? Thanks in advance.
I was able to fix the issue by changing the below parameter.
wait_for_guest_net_timeout = 0