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)
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
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.
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.
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
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
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Cloud9er
Highly Voted 2 years, 6 months agoEltooth
Highly Voted 2 years, 4 months agoBere
Most Recent 1 month, 4 weeks ago090200f
4 months, 2 weeks agoJayanth
1 year, 3 months agoBusi57
1 year, 4 months agoMandeeps468
1 year, 5 months agowsyh
1 year, 6 months agoChandru1988
1 year, 6 months agoPower123
1 year, 7 months agoMal_8
1 year, 9 months agoZam88
2 years, 5 months agosubhala
2 years, 5 months agosoftarts
2 years, 6 months agoEniras
2 years, 6 months agocalebvar
2 years, 7 months agoAhmad_Terraform
2 years, 5 months ago