Ahmed Abdelwahed

Cloud & Systems Specialist | Microsoft Certified Trainer

Open to New Opportunities

Terraform for VMware vSphere | Quick Guide

Last updated on January 28, 2026

Terraform for VMware vSphere | Quick Guide

Automate VM deployments on vSphere using Terraform — from installing the provider to deploying fleets of VMs with custom sizes, IPs, and host targeting. Infrastructure as Code, lab-proven.

This quick guide walks you through automating VM deployments on VMware vSphere using Terraform, starting from a fresh Windows installation all the way to deploying multi-VM fleets with custom CPU, memory, and IP configurations. Each lab is built against a real vCenter environment at vcenter.abdelwahed.me with full main.tf code provided and screenshots from production deployments.

What This Guide Covers

This quick guide walks you through the core of Terraform-driven vSphere automation:

  • Terraform Installation — Installing Terraform on Windows, adding it to the system PATH, and verifying the install with terraform –version
  • Configuration & Workflow — Writing main.tf, then running terraform init, plan, and apply against your vCenter environment
  • Single VM Deployment — Cloning a Linux template into a VM with a static IP, custom hostname, and EFI firmware
  • Loop-Based Scaling — Using the count meta-argument to deploy multiple VMs with sequentially assigned static IPs
  • Host Targeting — Deploying VMs to a specific ESXi host instead of the cluster resource pool for host-pinning scenarios
  • Heterogeneous VM Sizes — Using variable maps to deploy VMs with different CPU, memory, and IP configurations in a single apply

Complete Lab Index

The guide is structured into 4 hands-on labs:

  • Lab 1: Create 1 Linux VM from a Template — 2 vCPU / 1 GB, 192.168.221.100, EFI, thin provisioned
  • Lab 2: Deploy 10 VMs with Custom IP Range — count loop, IPs from 192.168.221.20
  • Lab 3: Deploy 5 VMs on a Specific ESXi Host — pinned to h2.abdelwahed.me, IPs .40–.44
  • Lab 4: Deploy VMs with Different Sizes — variable map: web 2 vCPU/2 GB, db 4 vCPU/4 GB, test 1 vCPU/1 GB

Perfect For

  • VMware Admins wanting to automate repetitive VM provisioning tasks in vSphere
  • DevOps Engineers adopting Infrastructure as Code for on-premises VMware environments
  • Cloud Architects bridging traditional vSphere to hybrid or multi-cloud workflows

Guide Details

  • Platform: VMware vSphere / vCenter
  • Tool: Terraform (HashiCorp)
  • Length: 4 Hands-on Labs
  • Version: 25.06

Ready to Automate vSphere with Terraform?

Download the complete guide — full Terraform code, step-by-step labs, and production screenshots. Free to download.

📥 Download the Terraform for vSphere Guide (PDF)


Have questions about Terraform or automating vSphere deployments? Connect with me directly through the links below!