What this book covers
Chapter 1, Packer Fundamentals, introduces Packer to those who have never used it before. This chapter will look at the use cases, architecture, and history of the project, as well as covering the basics of a Packer build process.
Chapter 2, Creating Your First Template, covers a traditional Hello World equivalent code example for Packer. This establishes the basic context for starting any Packer template.
Chapter 3, Configuring Builders and Sources, explores how to invoke one or more instances of a builder using sources in HCL2 syntax.
Chapter 4, The Power of Provisioners, describes how once an environment has been defined in a source, provisioners load or run customization to set up your desired applications and artifacts. The name provisioner comes from ships loading what they need for a voyage, a concept common to HashiCorp’s Vagrant, Packer, and Terraform products.
Chapter 5, Logging and Troubleshooting, highlights how, during the development process, it’s inevitable that troubleshooting will need to be done when builds go wrong. This isn’t always clear when doing multiple complex builds.
Chapter 6, Working with Builders, takes a deeper dive into the different types of builders available, from the local builders of VMware, VirtualBox, and QEMU to cloud builders and Docker containers. We will also explore alternative architectures with QEMU , which is able to emulate a wide variety of architectures.
Chapter 7, Building an Image Hierarchy, establishes how as images share things in common or extend other images, it becomes important to implement an image hierarchy strategy. We cover extended system images and container images in a logical way.
Chapter 8, Scaling Large Builds, shows how when large or complex builds or multi-cloud builds become slow, it’s time to optimize parallel builds. We will discuss parallel builds and make sure you don’t have to wait longer than necessary for a build result.
Chapter 9, Managing the Image Lifecycle, covers what to do when images become old and obsolete or need urgent patching. It’s important to set up a lifecycle strategy.
Chapter 10, Using HCP Packer, introduces HCP Packer, a SaaS platform from HashiCorp that allows automatic metadata and lifecycle management for the cloud. Here, we cover the basics of HCP’s free tier and, optionally, the paid tier.
Chapter 11, Automating Packer Builds, applies automation to everything learned about in the previous chapters. Packer runs can run via automated pipelines using common VCS offerings such as GitHub Actions or GitLab CI.
Chapter 12, Developing Packer Plugins, shows what to do if you come across a potential use case that Packer doesn’t cover. You may be able to extend the project with a plugin. This is an advanced topic that requires some understanding of Go.