Sample plugin source
Always start with a current copy of the scaffold plugin repo. This has a few important files in the root directory, including main.go
, GNUMakefile
, and go.mod
, which pins certain versions of the dependencies used by your Go module. It also declares a Go module, which you should rename to your module. Here, we use packer-plugin-nspawn
for our module name. Have a look at the repository here: https://github.com/jboero/packer-plugin-nspawn.
The repo contains sample folders for each plugin type:
builder
: We will use this to start asystemd-nspawn
machinedatasource
: We will use this to look up the machines and images availablepost-processor
: We won’t need one of these so we delete the directoryprovisioner
: We also won’t need one of these so we will delete it
The plugin registers itself in the very simple main.go
file. Post-processors and provisioners may be added for custom actions but we won’t need anything. Packer...