Hello,
Having never used Packer or Terraform, I can't answer quickly. From my research, I haven't found anything yet related to vTPM.
I've just asked our DevOps team about this so they can bring us more information on it or record it as a future evolution.
You can enable vTPM from Xen Orchestra or directly from the command line via xe
, in XCP-ng 8.3:
xe vtpm-create vm-uuid=<vm_uuid>
Several commands are also available for vTPM management:
vtpm-create - Create a VTPM associated with a VM vtpm-param-clear - Clears the specified parameter (param-name can be allowed operations)
vtpm-destroy - Destroy a VTPM vtpm-param-get - Gets the specified parameter of the object
vtpm-list - Lists all the vtpms, filtering on the optional arguments vtpm-param-list - Lists all the parameters of the object specified by the uuid
If you use a script to create your VMs, you should be able to enable vTPM immediately after creating them, before starting their installation.