In Terraform, a provisioner must be placed inside which block?

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

In Terraform, a provisioner must be placed inside which block?

Explanation:
Provisioners are actions that run on the machine created by Terraform, after the resource is created (and sometimes on destroy). They must be defined inside a resource block so Terraform knows which resource to provision and where to execute the steps. Data blocks fetch existing information and outputs simply expose values, neither of which support provisioning. Module blocks organize resources, but provisioning is attached to the actual resource definitions inside the module, not to the module block itself. So the correct placement is inside a resource block.

Provisioners are actions that run on the machine created by Terraform, after the resource is created (and sometimes on destroy). They must be defined inside a resource block so Terraform knows which resource to provision and where to execute the steps. Data blocks fetch existing information and outputs simply expose values, neither of which support provisioning. Module blocks organize resources, but provisioning is attached to the actual resource definitions inside the module, not to the module block itself. So the correct placement is inside a resource block.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy