nerdexam
HashiCorp

TA-002-P · Question #144

By default, a defined provisioner is a creation-time provisioner.

The correct answer is A. True. By default, Terraform provisioners are executed only once when the resource they are associated with is initially created.

Understand Terraform basics

Question

By default, a defined provisioner is a creation-time provisioner.

Options

  • ATrue
  • BFalse

How the community answered

(34 responses)
  • A
    91% (31)
  • B
    9% (3)

Why each option

By default, Terraform provisioners are executed only once when the resource they are associated with is initially created.

ATrueCorrect

Terraform provisioners are 'creation-time' provisioners by default, meaning they run after the resource they are attached to has been successfully created. If you want a provisioner to run during destruction, you must explicitly set its 'when' argument to 'destroy'.

BFalse

This is incorrect; the default behavior for provisioners is to execute at resource creation time, not at other lifecycle stages without explicit configuration.

Concept tested: Terraform provisioner default execution timing

Source: https://developer.hashicorp.com/terraform/language/resources/provisioners/syntax#creation-time-provisioners

Topics

#Provisioners#Resource Lifecycle#Terraform Defaults

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice