Creating multiple resources
count = 3 creates a list indexed [0], [1], [2]. The trap: identity is POSITIONAL. Remove the middle element of the source list and everything after it shifts index - Terraform plans to destroy and recreate resources that only 'moved'. Fine for genuinely identical, order-free copies or the count = var.enabled ? 1 : 0 toggle.
for_each over a map or set creates instances keyed by STABLE strings: aws_instance.app["api"]. Adding or removing one key touches only that instance. Slightly more ceremony (need a keyed collection; keys must be known at plan time).
Default to for_each for anything with identity (named buckets, per-service roles, per-env anything). Reserve count for the boolean-toggle idiom and truly interchangeable replicas. 'count reshuffles on removal, for_each doesn't' is the exact sentence interviewers want.