Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 7


Which provisioner invokes a process on the resource created by Terraform?

Show Answer
Correct Answer: A

The remote-exec provisioner invokes a script or command on a remote resource after it has been created. This provisioner connects to the remote resource using SSH or WinRM and runs the specified commands directly on that resource. This is different from the local-exec provisioner, which runs commands on the machine where Terraform is being executed, not on the remote resource. Therefore, for invoking a process on a resource created by Terraform, the remote-exec provisioner is the appropriate choice.

Discussion

17 comments
Sign in to comment
Cloud9er
May 5, 2022

No. Answer is remote-exec. because...The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource. (this is from the terraform web site)

EltoothOption: A
Jul 6, 2022

A is correct answer : remote-exec. "The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource." https://www.terraform.io/language/resources/provisioners/local-exec "The remote-exec provisioner invokes a script on a remote resource after it is created." https://www.terraform.io/language/resources/provisioners/remote-exec

Eniras
May 5, 2022

The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource. See the remote-exec provisioner to run commands on the resource. https://www.terraform.io/language/resources/provisioners/local-exec

softarts
May 16, 2022

I take A remote-exec.

Mal_8Option: A
Feb 18, 2023

A is the correct answer : remote-exec

BereOption: A
Sep 24, 2024

The remote-exec provisioner invokes a script on a remote resource created by Terraform. It connects to the resource using SSH or WinRM and runs the provided inline or script commands. Here's an example of how you might use it: resource "aws_instance" "example" { ami = "ami-0c94855ba95c574c8" instance_type = "t2.micro" provisioner "remote-exec" { inline = [ "echo Hello, World! > /home/ubuntu/hello", "chmod +x /home/ubuntu/hello", ] } } There's no null-exec provisioner in Terraform. The local-exec provisioner invokes a local executable after a resource is created. It runs on the machine where Terraform is being executed. The file provisioner is used to copy files or directories from the machine executing Terraform to the newly created resource.

muammer32Option: A
Dec 13, 2024

The remote-exec provisioner is the one that invokes a process on the resource created by Terraform, running commands or scripts on the remote machine after it has been provisioned.

calebvar
Apr 25, 2022

Isn't local exec also correct?

Ahmad_Terraform
Jun 22, 2022

Eniras explained well about the Local Exec,

subhala
Jun 17, 2022

I think it is remote-exec, the question is asking about on the resource created by terraform. local-exec runs on the machine where we run terraform.

Zam88
Jun 20, 2022

The remote-exec provisioner invokes a script on a remote resource after it is created. This can be used to run a configuration management tool, bootstrap into a cluster, etc. To invoke a local process, see the local-exec provisioner instead. The remote-exec provisioner requires a connection and supports both ssh and winrm. remote-exec correct

Power123
Mar 28, 2023

A is correct

Chandru1988
May 10, 2023

Definitely Remote-exec

wsyhOption: A
May 22, 2023

Vote A. local-exec provisioner is execute on the local machine.

Mandeeps468
Jun 8, 2023

A - correct answer : remote-exec

Busi57Option: A
Jul 23, 2023

remote-exec -> A

Jayanth
Jul 28, 2023

A. remote-exec

090200f
Jul 8, 2024

A is correct ans : "process on the resource" is key point here. so remote-exec. The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource.