A Terraform provisioner must be nested inside a resource configuration block. Which of the following best reflects this statement?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

A Terraform provisioner must be nested inside a resource configuration block. Which of the following best reflects this statement?

Explanation:
Provisioners are tied to the lifecycle of a resource. They must be declared inside the resource block so Terraform runs them as part of that resource’s creation, update, or destruction. You specify what to run with a provisioner (for example, remote-exec to run commands on the created instance or local-exec to run commands on the machine running Terraform). If you want to perform provisioning steps without managing a real resource, you can use a placeholder resource like a null_resource, but you still define provisioners inside that resource block. They cannot be defined outside of a resource. Because of this, the statement is true.

Provisioners are tied to the lifecycle of a resource. They must be declared inside the resource block so Terraform runs them as part of that resource’s creation, update, or destruction. You specify what to run with a provisioner (for example, remote-exec to run commands on the created instance or local-exec to run commands on the machine running Terraform). If you want to perform provisioning steps without managing a real resource, you can use a placeholder resource like a null_resource, but you still define provisioners inside that resource block. They cannot be defined outside of a resource. Because of this, the statement is true.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy