Packer workflow: how to avoid rebuilding and safely iterate provisioning


I’m trying to move a very standard Rails app to Packer + Ansible + Terraform, on AWS.

After following some of the Pluralsight courses, this was my understanding of a possible workflow:

  1. Create an AMI in packer (based of a pre-defined AWS AMI - says RHEL);
  2. Provision with Ansible;
  3. Pipe through to Terraform somehow.

However being new to Ansible and having to port my existing configuration over, I don’t really understand the workflow because Packer creates a new image every single time, which doesn’t take ages but is slow enough to discourage anyone from iterating on the provisioning config (i.e my playbook.yml).

How do you people work with it? My current hack/solution is to use the vagrant postprocessors to build a box that I would import in Vagrant*, and then run Ansible against that instead of retrying every time against a live AWS agent.

Any pointers appreciated.

* although I’m even struggling with that step.