TERRAFORM-ASSOCIATE-004 · Question #119
If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?
The correct answer is B. It will happen automatically. When you manually delete infrastructure outside of Terraform, the next time you run 'terraform plan' or 'terraform apply', Terraform automatically performs a refresh against the real infrastructure before computing the diff. It discovers that the resource no longer exists and upd
Question
Options
- ARun terraform refresh
- BIt will happen automatically
- CManually update the state fire
- DRun terraform import
How the community answered
(25 responses)- A4% (1)
- B88% (22)
- C8% (2)
Explanation
When you manually delete infrastructure outside of Terraform, the next time you run 'terraform plan' or 'terraform apply', Terraform automatically performs a refresh against the real infrastructure before computing the diff. It discovers that the resource no longer exists and updates its internal understanding accordingly, showing the resource as needing to be re-created (or flagging the drift). You do not need to manually edit the state file or run a separate command - the detection and state reconciliation happen automatically during the normal plan/apply cycle.
Topics
Community Discussion
No community discussion yet for this question.