VMware {code} Community
justinsmith
Enthusiast
Enthusiast

Build VM's with Terraform and Cluster Placement

Asking here since I may have asked in the wrong location...

Im using Terraform to build VM's. We have specific roles defined for VM's (app, web, login, etc). In my main.tf I have the computer cluster name defined, server/s gets built, configured and all is well.

We currently have multiple clusters in vCenter. What Im running into now is lets say we have 8 servers for each role. I want terraform to balance them across the multiple clusters in vCenter and not place all the web servers on one cluster.

How can I get VMWare to NOT put all 8 servers for a specific role on one host in the cluster? Either put 2 from each role type on 4 servers, or 4 on 2 different servers? I've used Anti-Affinity rules before but I dont think theres a way, using Terraform, to tell it which anti-affinity rule to use when deployed and the vm's need to be created first before adding them to a VM/Host rule?

0 Kudos
0 Replies