terraform: fix crash if depends_on used when state has orphans