HashiCorp Certified: Terraform Associate — Question 251
As a member of the operations team, you need to run a script on a virtual machine created by Terraform. Which provision is best to use in your Terraform code?
Answer options
- A. null-ex׀µׁ
- B. local-exec
- C. remote-exec
- D. file
Correct answer: C
Explanation
The correct answer is C, remote-exec, as it allows you to run scripts on remote machines after they have been created. Options A (null-exec) does not execute any commands, B (local-exec) runs commands on the machine where Terraform is executed rather than the remote VM, and D (file) is used to upload files but does not execute scripts.