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
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.