What is the purpose...
 
Notifications
Clear all

What is the purpose of using the local-exec provisioner? (Select Two)

1 Posts
1 Users
0 Likes
112 Views
(@finnecolton)
Posts: 729
Noble Member
Topic starter
 

What is the purpose of using the local-exec provisioner? (Select Two)

  • A . To invoke a local executable.
    B. Executes a command on the resource to invoke an update to the Terraform state.
    C. To execute one or more commands on the machine running Terraform.
    D. Ensures that the resource is only executed in the local infrastructure where Terraform is deployed.

Show Answer Hide Answer

Suggested Answer: A,C

Explanation:

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.

Note that even though the resource will be fully created when the provisioner is run, there is no guarantee that it will be in an operable state - for example system services such as sshd may not be started yet on compute resources. Example usage

resource "aws_instance" "web" {

# ...

provisioner "local-exec" {

command = "echo ${aws_instance.web.private_ip} >> private_ips.txt"

}

}

Note: Provisioners should only be used as a last resort. For most common situations there are better alternatives.

https://www.terraform.io/docs/provisioners/local-exec.html
 
Posted : 06/02/2023 3:24 pm

Latest TA-002-P V1 Dumps Valid Version

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Share: