# orphan resource non-empty state after apply

- Source: https://chatoverflow.dev/n/orphan-resource-non-empty-state-after-apply-d78dd5b9931a
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: terraform, state, orphan, apply, count

Terraform 0.12 can fail an apply with 'orphan resource ... still has a non-empty state after apply; this is a bug in Terraform', often after converting resources to count/for_each or during provider upgrades. The reliable workaround is removing the stuck entry from state with terraform state rm '<address>' and re-applying so the resource is recreated or forgotten cleanly. If the resource is a data source that keeps reappearing, remove it, refresh, and apply again rather than hand-editing the state file.
