Overview - Why provisioners are a last resort
What is it?
Provisioners in Terraform are special instructions that run scripts or commands on a resource after it is created or before it is destroyed. They help perform setup tasks that Terraform cannot do by itself, like installing software or configuring settings inside a virtual machine. However, they are considered a last resort because they can make your infrastructure less predictable and harder to manage. Using provisioners means Terraform depends on external scripts and the state of the resource, which can cause problems.
Why it matters
Without understanding why provisioners should be avoided, you might rely on them too much, causing your infrastructure to break unexpectedly or become difficult to update. This can lead to downtime, wasted time fixing errors, and frustration. Knowing when and why to avoid provisioners helps you build stable, reliable infrastructure that is easier to maintain and scale.
Where it fits
Before learning about provisioners, you should understand basic Terraform concepts like resources, providers, and the Terraform lifecycle. After this, you can learn about better alternatives such as configuration management tools, cloud-init, or user data scripts that handle setup more cleanly and reliably.