Three Levels of Evolution in VMware Infrastructure Management
If you’re managing VMware, chances are you fall into one of the three “evolutionary zones” below. Let’s see where you stand.
- Level 1: Manual Management (GUI-based). You log into vCenter, right-click a Cluster, and select “New Virtual Machine”. This works for 1-2 VMs. However, if you need 20 VMs for K8s, clicking “Next-Next-Finish” for 2 hours is pure torture.
- Level 2: Scripting (PowerCLI). You use PowerShell to command vCenter. This is faster but “Imperative”. You have to tell the machine to perform steps A, B, and C. If you run the script a second time without checks, the system might fail due to duplicate names or existing resources.
- Level 3: Infrastructure as Code (Terraform). This is the “Declarative” mindset. You only describe the desired end state. For example: “I want 3 Ubuntu machines, 4GB RAM, Network VLAN 10”. Terraform calculates how to match reality.
Why is Terraform More “Bang for Your Buck” Than PowerCLI?
In the past, I used to spend an entire afternoon just cloning a dozen Linux VMs and manually changing IPs. When I switched to Terraform, everything changed. The biggest selling point is State Management.
Terraform uses the terraform.tfstate file to remember the infrastructure. If someone accidentally deletes a VM in vCenter, Terraform will detect it immediately. On the next run, it will automatically recreate that specific VM to restore the previous state.
Of course, it’s not all sunshine and rainbows. You need a basic programming mindset and a standard directory structure. If you lose the state file, resyncing existing infrastructure will cause quite a headache.
Real-world experience: When I migrated my lab from VMware to Proxmox, thanks to Terraform, I only had to change the Provider. All RAM, CPU, and Network Topology configurations were recreated accurately in less than 10 minutes.
Checklist Before You Start Coding
To get started smoothly, you need to prepare three things:
- vCenter Server: An account with Admin rights or permissions to create/delete resources.
- Terraform Binary: Download the latest version from HashiCorp.
- VM Template: A VM with a pre-installed OS (like Ubuntu 22.04),
open-vm-toolsinstalled, and converted to a Template.
Deploying Your First VM in 4 Steps
Step 1: Connecting to vCenter
Create a main.tf file to declare vCenter information. Note: In Lab environments, we often use self-signed certificates, so allow_unverified_ssl must be enabled.
provider "vsphere" {
user = "[email protected]"
password = "YourPasswordHere"
vsphere_server = "vcenter.yourdomain.com"
allow_unverified_ssl = true
}
Step 2: Querying Resources (Data Sources)
Instead of hard-coding IDs, which is error-prone, let Terraform find the Datacenter or Network IDs by name.
data "vsphere_datacenter" "dc" { name = "Datacenter-HN" }
data "vsphere_datastore" "ds" {
name = "Storage-SATA"
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_network" "net" {
name = "VM Network"
datacenter_id = data.vsphere_datacenter.dc.id
}
Step 3: Defining the Virtual Machine
This is where you design the “shape” of your server. The code below clones from a template and assigns a static IP automatically.

