@hashicorp
The Hyper-V plugin can be used with HashiCorp Packer to create custom images from Hyper-V.
- Community
Updated 11 months ago
- GitHub(opens in new tab)
Hyper-V
The HyperV Packer Plugin is able to create Hyper-V virtual machines and export them.
Installation
To install this plugin, copy and paste this code into your Packer configuration, then run packer init
.
packer { required_plugins { hyperv = { source = "github.com/hashicorp/hyperv" version = "~> 1" } }}
Alternatively, you can use packer plugins install
to manage installation of this plugin.
$ packer plugins install github.com/hashicorp/hyperv
Components
Builders
hyperv-iso - Starts from an ISO file, creates a brand new Hyper-V VM, installs an OS, provisions software within the OS, then exports that machine to create an image. This is best for people who want to start from scratch.
hyperv-vmcx - Clones an existing virtual machine, provisions software within the OS, then exports that machine to create an image. This is best for people who have existing base images and want to customize them.
Running from WSL2
This plugin supports being run from WSL2 provided its run from a windows filesystem and the PACKER_CACHE_DIR is set to a path on the windows filesystem.
For example, assuming a Windows username of user
:
/mnt/c/Users/user/$ PACKER_CACHE_DIR=/mnt/c/Users/user/.packer packer build ...