How to debug errors when configuring a linux VM via linux_options?

Hi all,

I am trying to create a VM in vSphere using an existing VM template. The template was created by uploading a VMDK image, creating a VM using the VMDK and then cloning it into a template. This was done manually, as I understand the provider does not (yet) offer this functionality.

The VM is being created and starts, I can watch the console and everything looks good, until it hits the step where the linux_options are being applied. At this point Terraform errors out and tells me that something has gone wrong.

If I omit the whole customize block the VM boots up but never gets an IP address via DHCP, no matter what I put into the metadata file.

Any ideas how to debug this further (as I cannot login to the VM)?

Thanks in advance!

Kind Regards,
Johannes

P.S.: Here are the relevant snippets:

  clone {
    template_uuid = var.vsphere_vm_template_id
    customize {
      linux_options {
        host_name = "my-hostname"
        domain    = "example.org"
      }
      network_interface {
        # empty, to use DHCP
      }
    }
  }
  extra_config = {

    "guestinfo.metadata"          = var.metadata_base64encoded
    "guestinfo.metadata.encoding" = "base64"
    "guestinfo.userdata"          = var.userdata_base64encoded
    "guestinfo.userdata.encoding" = "base64"
  }

metadata file for cloud-config:

instance-id: cloud-vm
network:
  version: 2
  ethernets:
    nics:
      match:
        name: e*
      dhcp4: true

And no matter what I try, even though there are no errors shown during boot up, the cloud-init configuration file seems to not be respected completely. I can set a SSH authorized_key for the image’s default user, but cannot login with the password I provide in the cloud-init userdata file.

When hitting the linux_options snag, Terraform throws an error. Try debugging by carefully reviewing your customize block. Also, check DHCP settings and Digital billboards metadata file contents.

Hi @jhonphillips7272,
thanks for the reply.

I would like to debug. But as I cannot login, how would I start?

And the linux_options block is only two strings with hostname and domain, there is not much I can change there. I also cannot omit any of them.

Kind Regards,
Johannes