Recall & Review
beginner
What is the purpose of the
local-exec provisioner in Terraform?The
local-exec provisioner runs a command on the machine where Terraform is executed, allowing you to perform local actions during resource creation or destruction.Click to reveal answer
beginner
How does
local-exec differ from remote-exec provisioner?local-exec runs commands on the local machine where Terraform runs, while remote-exec runs commands on the remote resource (like a VM) after it is created.Click to reveal answer
beginner
Which argument is required inside a
local-exec provisioner block to specify the command to run?The
command argument specifies the shell command or script to execute locally.Click to reveal answer
intermediate
Can
local-exec provisioner access Terraform resource attributes?Yes, you can use Terraform interpolation syntax to pass resource attributes as part of the command string to
local-exec.Click to reveal answer
beginner
What is a common use case for
local-exec provisioner?A common use case is to run local scripts for configuration, notify external systems, or trigger local automation after resource creation.
Click to reveal answer
Where does the
local-exec provisioner run its commands?✗ Incorrect
The local-exec provisioner runs commands on the local machine where Terraform is executed.
Which argument must you include in a
local-exec provisioner block?✗ Incorrect
The command argument specifies the command to run locally.
Can
local-exec provisioner run after a resource is destroyed?✗ Incorrect
You can configure local-exec to run during resource destruction by setting when = destroy.
Which of these is NOT a recommended use of
local-exec?✗ Incorrect
Running commands on the remote VM should use remote-exec, not local-exec.
How can you pass resource data to a
local-exec command?✗ Incorrect
Terraform interpolation allows embedding resource attributes directly in the command string.
Explain what the
local-exec provisioner does in Terraform and give an example of when you might use it.Think about actions you want to perform on your own computer after creating cloud resources.
You got /3 concepts.
Describe how you would configure a
local-exec provisioner to run a shell command that uses an attribute from a created resource.Remember Terraform lets you insert resource data inside strings with ${}.
You got /3 concepts.