When to provision in Packer vs Terraform? : <p>I am sitting with a situation where I need to provision EC2 instances with some packages on startup. There are a couple of (enterprise/corporate) constraints that exist:</p>

<ul>
<li>I need to provision on top of a specific AMI, which adds enterprisey stuff such as LDAP/AD access and so on</li>
<li>These changes are intended to be used for all internal development machines</li>
</ul>

<p>Because of mainly the second constraint, I was wondering where is the best place to place the provisioning. This is what I've come up with</p>

<p><strong>Provision in Terraform</strong></p>

<p>As it states, I simply provision in terraform for the necessary instances. If I package these resources into modules, then provisioning won't "leak out". The disadvantages</p>

<ul>
<li>I won't be able to add a different set of provisioning steps on top of the module? </li>
<li>A change in the provisioning will probably result in instances being destroyed on apply?</li>
<li>Provisioning takes a long time because of the packages it tries to install</li>
</ul>

<p><strong>Provisioning in Packer</strong></p>

<p>This is based on the <a href="https://www.packer.io/intro/getting-started/build-image.html" rel="noreferrer">assumption</a> that Packer allows you to provision on top of AMIs so that AMIs can be "extended". Also, this will only be used in AWS so it won't use other builders necessarily. Provisioning in Packer makes the Terraform Code much simpler and terraform applies will become faster because it's just an AMI that you fire up.</p>

<p><strong>For me both of these methods have their place. But what I really want to know is when do you choose Packer Provisioning over Terraform Provisioning?</strong></p>
