Which provisioner executes a command on the machine running Terraform?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which provisioner executes a command on the machine running Terraform?

Explanation:
Local-exec runs a command on the machine where you run Terraform. This is exactly what the prompt is asking: the command is executed on the local control plane, not on the remote resource. This is useful for tasks that should happen on your workstation or CI server, such as triggering a local script, integrating with external tooling, or post-processing Terraform outputs. In contrast, remote-exec would run on the newly created resource (via SSH/WinRM), and the file provisioner copies files to the remote resource. There isn’t a separate provisioner called null-exec; you’d typically use a null_resource with provisioners if you need a combination of local and remote actions.

Local-exec runs a command on the machine where you run Terraform. This is exactly what the prompt is asking: the command is executed on the local control plane, not on the remote resource. This is useful for tasks that should happen on your workstation or CI server, such as triggering a local script, integrating with external tooling, or post-processing Terraform outputs.

In contrast, remote-exec would run on the newly created resource (via SSH/WinRM), and the file provisioner copies files to the remote resource. There isn’t a separate provisioner called null-exec; you’d typically use a null_resource with provisioners if you need a combination of local and remote actions.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy