0

I'm using Terraform to provision virtual machines in an ESXi environment. I do this by having once manually imported the Ubuntu Focal Cloud Image as template and cloning virtual machines from it, with parameters supplied by a combination of vApp properties and extra_config:

vapp {
    properties = {
      "hostname" = "terraform-test"
      # user ubuntu
      "password"  = "xxx"
      "user-data" = base64encode(file("${path.module}/cloudinit/kickstart.yml"))
    }
  }
  extra_config = {
    "guestinfo.metadata"          = base64encode(file("${path.module}/cloudinit/metadata.yml"))
    "guestinfo.metadata.encoding" = "base64"
    "guestinfo.userdata"          = base64encode(file("${path.module}/cloudinit/userdata.yml"))
    "guestinfo.userdata.encoding" = "base64"
  }

Unfortunately, cloud-init does not apply anything from metadata/userdata.yml. The reason seems to be that while sudo DI_LOG=stderr /usr/lib/cloud-init/ds-identify --force yields Found 2 datasources found=all: OVF VMware, cloud_id only sees ovf.

The passing of the extra_config stuff works, vmware-rpctool 'info-get guestinfo.userdata'|base64 --decode yields the correct content - the issue therefore must be somewhere in cloud-init.

How do I tell cloud-init to force using solely the VMware data source?

user1933738
  • 247
  • 1
  • 6
  • Hello did you try to deploy ubuntu cloud image with metadata manually on vsphere? – JMHerrer Dec 17 '21 at 02:13
  • Yes, to be precise the "focal-server-cloudimg-amd64.ova" image that according to its description ("VMware/Virtualbox OVA") is specifically made for VMware. – user1933738 Dec 18 '21 at 12:04

0 Answers0