What are provisioners and why does HashiCorp call them a last resort?
IntermediateConceptLifecycle, Dependencies, Provisioners and Drift
Answer
Provisioners (local-exec, remote-exec, file) run scripts when a resource is created or destroyed. They are imperative, not part of the plan, cannot be diffed, need network and credentials access to the host and leave tainted resources on failure. Better options: user data or cloud-init, golden images with Packer, configuration tools like Ansible, or provider resources.
More on Lifecycle, Dependencies, Provisioners and Drift
What are meta-arguments?BeginnerWhat lifecycle options are available?BeginnerHow does `create_before_destroy` work and what can go wrong?AdvancedWhat does `prevent_destroy` guarantee and what does it not?AdvancedWhen do you use `ignore_changes`?IntermediateWhat does `replace_triggered_by` do?Advanced