Workflow


Initialize

packer init -var-file variables.pkrvars.hcl .
Initialize the directory (download plugins, ...).


Validate and Format (optional)

packer validate -var-file variables.pkrvars.hcl .
Validate config file.

packer fmt -var-file variables.pkrvars.hcl .
Format config file.


Build

packer build -var-file variables.pkrvars.hcl .
Build config file.

Misc


Convert from JSON to HCL

packer hcl2_upgrade myUbuntu.json
Convert JSON file to HCL.