Breakdown of components, variables, and artifacts
HCL templates rely on the declaration of sources and parameters, which are then invoked in a build declaration. The build block declares a list of sources to use and which provisioners to run on them. In this case, we’re defining just one source using the virtualbox-iso
builder:
source "virtualbox-iso" "hello-base" {
Note that there are actually multiple builders that support VirtualBox: ISO, OVF, or VM. ISO is the standard way you might install a VirtualBox machine from a DVD image or ISO file. This slightly complicates our installation because we need two steps:
- Format and install a virtual hard disk.
- Boot from the new install and finish provisioners over SSH.
Once this image is built into an OVF output, it can be used as a quicker base image to try other build options, since no ISO installation will be necessary. Instead, the VirtualBox OVF builder can be used to rapidly create...