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?