Skip to content

Kamga-Roland/terraform-vpshere

Repository files navigation

Terraform vSphere VM Automation with Packer

This repository contains Infrastructure as Code (IaC) for automating virtual machine provisioning on VMware vSphere using Terraform and Packer.
It enables consistent VM builds, rapid deployment, and simplified lifecycle management.


🚀 Features

  • Automated VM creation on vSphere with Terraform
  • Golden image building with Packer
  • Configurable CPU, memory, disk, and network settings
  • Support for cloning from templates
  • Easy customization via variables

📦 Prerequisites

  • Terraform >= 1.0
  • Packer
  • VMware vSphere environment (vCenter + ESXi)
  • vSphere credentials with sufficient permissions
  • Access to a datastore and network in vSphere

⚙️ Setup

  1. Clone the repo
    git clone https://github.com/your-org/terraform-vsphere-vm-automation.git
    cd terraform-vsphere-vm-automation

vsphere_user = "administrator@vsphere.local" vsphere_password = "yourpassword" vsphere_server = "vcenter.example.com"

  1. Configure variables Create or edit terraform.tfvars: datacenter_name = "Datacenter" cluster_name = "Cluster" datastore_name = "Datastore" network_name = "VM Network" ubuntu_name = "ubuntu-template"

  2. Build base image with Packer

    packer build packer/ubuntu.json
    
  3. Initialize Terraform

    terraform init
    
  4. Validate configuration

    terraform validate
    
  5. Preview changes

    terraform plan
    
  6. Apply configuration

    terraform apply
    
  7. Destroy resources (optional)

    terraform destroy
    

About

This project provides Infrastructure as Code (IaC) for VMware vSphere environments, combining Terraform and Packer to streamline VM lifecycle management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages