What is Immutable Infrastructure?
The idea behind Immutable Infrastructure takes birth from the fact that you do not change existing infrastructure in case of any update or change, but deploy completely new servers with the changes pre-installed.
What is Packer?
Packer is a HashiCorp cross-platform tool that can help to create identical machine images for multiple platforms from a single source configuration. This reduces overhead on the DevOps team who manages multi-platform deployments (ex hybrid cloud) and wants consistency across machine images. It helps cloud engineers in performing critical system updates or resolving security issues and the team can track the lifecycle of images across clouds, and automate image updates across the Packer and Terraform lifecycle.
How can we leverage the power of Packer?
Immutable Infrastructure is key to successful cloud deployments nowadays. Immutable infrastructure means servers that are never modified for any change or update, they are rebuilt. This rebuilding process produces consistency and almost zero configuration drift. Rebuilding of these servers requires a standard for the common image build process. Packer comes into the picture at this point. Packer can help you to produce CI/CD process for creating base images or Golden Images for your infrastructure. These Images can include pre-installed applications and configurations.
How Packer Works?
Packer uses JSON formatted files called templates. Each template contains a series of declarations and commands for Packer to follow. Packer read templates to find out what plugins (builders, provisioners, post-processors) to use, how to configure each of those plugins, and what order to run them in to build an Image.
Earlier, Packer has used a JSON template for its configuration, but now Packer is transitioning to a new template configuration format that uses HCL2. HCL is the same…