TF-Associate-004 - Core Terraform workflow - Section 3f

Destroy Terraform-managed infrastructure.

terraform destroy removes all resources tracked in state for the configuration; a targeted destroy or -target scopes it. Candidates should understand destroy operates on managed state, and how it differs from removing a resource block and applying.

terraform destroydestroy operates on statetargeted destroyremoving a resource block versus destroy

Practice question for this objective

Free sampleCore Terraform workfloweasy

Aside from running 'terraform destroy', which action also causes Terraform to delete a managed resource on the next apply?

  • ACommenting out the resource's arguments while leaving the resource block header in place.
  • BSetting the resource's 'count' meta-argument to a value of one.
  • CAdding a 'depends_on' entry so the resource waits for another resource first.
  • DRemoving the resource block from the configuration entirely, then running apply. Correct
Understand that removing a resource block and applying destroys that resource, an alternative to terraform destroy. Apply reconciles configuration against state, so a resource still in state but absent from configuration is scheduled for destruction; deleting the block is therefore a targeted way to remove one resource.

Why A is wrong: Removing arguments changes the resource's settings and usually triggers an update or replacement, but as long as the block remains Terraform still manages the resource rather than deleting it.

Why B is wrong: A count of one keeps a single instance of the resource, so nothing is destroyed; only reducing count below the number of existing instances would remove any.

Why C is wrong: depends_on only orders operations and does not delete anything, so it changes when a resource is created but never causes its removal.

Why D is correct: Correct: with the block gone, Terraform sees a resource in state that is no longer in the configuration and plans to destroy it on apply.

See more TF-Associate-004 practice questions, answers explained.

More in this domain

Back to all Core Terraform workflow objectives, or the TF-Associate-004 cert hub.

Examworthy is not affiliated with or endorsed by HashiCorp. Original, blueprint-aligned practice material only.