Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 128


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?

Show Answer
Correct Answer: C

To run a script on a virtual machine created by Terraform, the remote-exec provisioner is the best choice. The remote-exec provisioner allows you to execute commands or scripts on a remote resource, which is suitable for configuring the virtual machine after its creation.

Discussion

8 comments
Sign in to comment
RVivekOption: C
Sep 26, 2022

remote-exec to run anything on the deployed virtual machine. local exec is to run anything on the system where terraform is running

bluee
Jan 3, 2023

thanks mate

Uma10Option: C
Sep 1, 2022

The remote-exec provisioner invokes a script on a remote resource after it is created. To invoke a local process, see the local-exec provisioner instead. Source: https://www.terraform.io/language/resources/provisioners/remote-exec

BurakkoOption: C
Sep 1, 2022

On a VM , it is a remote-exec.

bora4motionOption: C
Sep 2, 2022

VM is not local, I go with remote, C

keiffo2Option: C
Sep 6, 2022

remote-exec all day

legendary7Option: C
Sep 29, 2022

c is the correct answer

Only5Option: C
Feb 7, 2023

Source: https://www.terraform.io/language/resources/provisioners/remote-exec

imkhanOption: C
Oct 19, 2023

C- remote-exec is the correct answer If you need to run a script on a virtual machine created by Terraform, the remote-exec provisioner is the best choice. The remote-exec provisioner allows you to run commands or scripts on a remote machine, which is especially useful for configuring and provisioning resources after they have been created.