provisioner

A block inside a resource that runs a script, locally or on the new machine, after the resource is created or before it is destroyed.

They run arbitrary commands with your credentials, and their effects are invisible to plans and state.

In more detail

HashiCorp calls provisioners a last resort: Terraform cannot plan what the script will do, cannot detect drift in its results, and a failed script leaves the resource marked as tainted. Prefer a provider feature, machine start-up data, a pre-built image or a configuration management tool.

Example

provisioner "local-exec" {
  command = "echo created"
}

Related terms

Taught in

References

Certification courses