Skip to content

Instantly share code, notes, and snippets.

@tech-priv
Last active February 18, 2026 14:49
Show Gist options
  • Select an option

  • Save tech-priv/03ac8db0941028d272cd83d25c752bfb to your computer and use it in GitHub Desktop.

Select an option

Save tech-priv/03ac8db0941028d272cd83d25c752bfb to your computer and use it in GitHub Desktop.
packer {
  required_version = ">= 1.8.6"
  required_plugins {
    vsphere = {
      version = ">= v2.1.0"
      source  = "github.com/vmware/vsphere"
    }
  }
}

variable "ovf_export_folder" {
  type    = string
  default = "/var/tmp/export/"
}

source "vsphere-iso" "minimal-repro" {
  ssh_username        = "admin"
  ssh_password        = "secret"
  vcenter_server      = "vcenter.example.com"
  username            = "admin"
  password            = "secret"
  insecure_connection = true
  datacenter          = "dc01"
  cluster             = "cluster01"
  vm_name             = "repro-vm"
  guest_os_type       = "rhel8_64Guest"

  network_adapters {
    network      = "VM Network"
    network_card = "vmxnet3"
  }

  storage {
    disk_size             = 51200
    disk_thin_provisioned = true
  }

  iso_paths = ["[datastore1] ISO/rhel-8.iso"]

  export {
    output_directory = var.ovf_export_folder
  }
}

build {
  sources = ["source.vsphere-iso.minimal-repro"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment