I cannot set a host name / domain when using linux_options in customize like specified in the documentation.
It sets all the IP/DNS information without any issues but not the hostname.
I am customizing the Rocky 8.6 Image, vSphere has been updated to the latest release which supports Rocky customization.
I’m unsure how to tshoot this customization issue as I’m not receiving any errors from Terraform.
resource "vsphere_virtual_machine" "test-deploy" {
name = "test-host.test-domain.local"
num_cpus = 10
memory = 65536
sync_time_with_host = false
resource_pool_id = data.vsphere_resource_pool.pool-test.id
datastore_id = data.vsphere_datastore.test-primary-datastore.id
network_interface {
network_id = data.vsphere_network.network_test_vlan2.id
adapter_type = "vmxnet3"
}
connection {
type = "ssh"
target_platform = "unix"
user = "root"
password = var.root_password
host = self.default_ip_address
}
disk {
label = "disk0"
size = "150"
eagerly_scrub = false
thin_provisioned = false
}
clone {
template_uuid = data.vsphere_content_library_item.library_item_rocky8_base.id
customize {
linux_options {
host_name = "test-host"
domain = "test-domain.local"
}
network_interface {
ipv4_address = "1.1.1.1"
ipv4_netmask = "24"
}
ipv4_gateway = "1.1.1.254"
dns_server_list = [ "1.1.1.5" , "1.1.1.2" ]
dns_suffix_list = [ "test-domain" ]
}
}
provisioner "file" {
source = "./scripts/growDisk.sh"
destination = "/tmp/growDisk.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x /tmp/growDisk.sh",
"bash /tmp/growDisk.sh"
]
}
}