Interview Prep/Terraform/Dependencies, Cycles and Providers

`Error: Provider configuration not present` — `To work with module.dr.aws_s3_bucket.replica (orphan) its original provider configuration ... is required, but it has been removed.`

AdvancedTroubleshootingDependencies, Cycles and Providers
Answer

Likely causes → You removed a module call (or a provider alias like aws.dr) while its resources are still in state. Terraform needs that provider configuration to destroy them.

Diagnose → terraform state list | grep module.dr

Fix → Two-step removal: put the provider block (and module call, if removed) back, apply with the module removed so resources are destroyed, then delete the provider alias in a follow-up PR. If resources should survive, use removed blocks first.

Prevent → Never delete a provider configuration in the same change that removes the resources using it.

All Terraform questions Roadmap: Terraform

More on Dependencies, Cycles and Providers