Hi guys,
I’m trying to use the cloud-init to provision VMs with terraform in vmware.
My code:
resource "vsphere_virtual_machine" "vm1" {
name = "vm1"
resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
...
clone {
template_uuid = "${data.vsphere_virtual_machine.template.id}"
}
extra_config {
"guestinfo.userdata" = "${data.template_cloudinit_config.cloud-config.rendered}"
"guestinfo.userdata.encoding" = "gzip+base64"
"guestinfo.metadata" = <<-EOT
{ "local-hostname": "vm1.dfcddom0001" }
EOT
}
When execute the command terraform validade
I receive the error message.
Message error:
Error: Invalid argument name
on vm1.tf line 50, in resource "vsphere_virtual_machine" "vm1":
50: "guestinfo.userdata" = "${data.template_cloudinit_config.cloud-config.rendered}"
Argument names must not be quoted.
I think this is a problem with extra_config. I trying to use this, but not work whit me https://floating.io/2019/04/iaas-terraform-and-vsphere/