I'm curious about how people are integrating Terraform with VMware vSphere. What's your workflow like? Given that many VMs may remain in place, do you create individual scripts for each server or group multiple servers together in one script and keep it indefinitely, even if you don't plan on re-running it?
5 Answers
You typically need Terraform if you’re setting things up anew or for quick disaster recovery. Otherwise, I find it more efficient than doing things manually. It's all about the consistent ability to re-create environments, which is crucial.
I usually create a module that handles VM provisioning using variables. Then, I call this module with a `for_each` loop to pass parameters for each VM. If it's a one-off deployment, I just toss the state afterwards. But keep in mind that if you're using Terraform primarily for initial provisioning and not for ongoing management, it kinda misses the point of using Terraform in the first place.
Initially, I wrote PowerShell scripts to create a few Windows and Linux machines for my needs. Later, I wanted to elevate my process by using Jenkins to get environment info, followed by using Terraform for provisioning and Ansible for installing and configuring the software. However, I felt overwhelmed when I realized I’d need a way to create an inventory for Terraform, so I ended up sticking with Ansible.
I must admit, I've never tried Terraform because I've always relied on PowerCLI. But with everything changing these days, I think it’s about time I learned it. Does anyone have any good tutorials or resources for using Terraform with vSphere?
This really comes down to the cattle vs. pets analogy. VMs like domain controllers are the pets you care for long-term, while web servers are your cattle—setup quickly and replaced easily. Terraform is ideal for managing those cattle-like servers where rapid, consistent deployments are needed.
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures