@m4xm0rris Xen Orchestra's web application is doing this templating on the client side (reference). Since terraform already has a nice interface for templating (using its template_file
data source), you can do the substitution yourself.
Here is an example below. Note: this code is not tested but was pulled from an internal project I have.
# template_file.tpl
#cloud-config
hostname: ${name}
# any other cloud-config you need
[...]
# vm.tf
data "template_file" "cloud_config" {
template = file("${path.module}/template_file.tpl")
vars = {
name = "your_hostname_value"
}
}
resource "xenorchestra_cloud_config" "cloud_config" {
name = "cloud_config"
# This performs the templating
template = data.template_file.cloud_config.rendered
}
resource "xenorchestra_vm" "vm" {
[ ... ]
cloud_config = xenorchestra_cloud_config.cloud_config.template
}
Please share your terraform code if you would like more specific advice on how to recreate exactly what you are trying to do.