Interview Prep/Real-World Interview/Terraform and Ansible

`count` vs `for_each`?

IntermediateConceptTerraform and Ansible
Answer

count indexes resources by number, so removing a middle item shifts the others and recreates them. for_each keys resources by a map or set key, so the rest stay stable. Prefer for_each for collections.

All Real-World Interview questions Roadmap: Interview readiness

More on Terraform and Ansible