A Terraform plan says the billing database will be destroyed. The database block was deleted from the configuration by mistake, and the data is still required. What should the operator do?
Select an answer to reveal the explanation.
Short Explanation
The blueprint dropped the foundation, and the plan now says demolish it. Do not apply a Terraform plan that destroys the database just because the resource left your configuration. Put the database block back so the next plan keeps the data you still need.
Full Explanation
Terraform treats a resource that disappeared from the configuration as something to destroy on the next apply. Applying this plan deletes the billing database. The data is still required and the removal was a mistake, so the apply must not run. Restore the database block, plan again, and the destroy should be gone because the configuration and the state once again describe the same database. Auto-approve only skips the prompt. It still performs the destroy. Removing the database from state stops Terraform from destroying it on this plan and also stops managing it. When the block is later restored, Terraform can plan a second database because the real one is no longer in state. A fresh database from an apply would not contain the current billing data. Caveat: until the block is back, any apply of this configuration can still destroy the database, so read the plan for that destroy before you approve it. Operational check: after the block is restored, a new plan should show no destroy and no replacement for the billing database.