Interview Prep/Terraform/Plan Errors and Unexpected Replacements

`Error: Provider produced inconsistent result after apply` — `Root object was present, but now absent.`

AdvancedTroubleshootingPlan Errors and Unexpected Replacements
Answer

Likely causes → The provider created the object, but the read right after returned "not found" due to eventual consistency, or something deleted it immediately (an SCP or a cleanup Lambda). It's labelled a provider bug.

Diagnose → Check whether the object exists now; check CloudTrail for create and delete events.

Fix → If it exists, terraform import it (it isn't in state). If not, re-apply. Upgrade the provider if a fix exists.

Prevent → Keep providers current, and avoid automation that deletes resources right after creation.

All Terraform questions

More on Plan Errors and Unexpected Replacements