If you are used to Terraform, then an answer could be: when in Terraform you would feel the need to create a "Module":
https://developer.hashicorp.com/terraform/language/modules/develop
If you are not used to Terraform, then an answer could be: when you feel you are either duplicating a lot of code or when some resources need to be carefully configured in order to work as intended.
These answers are somewhat vague, but the question is a bit like: when should I split my main() function in multiple functions, and with which criteria?
That is, it is a very good question, but, at least in my opinion, it depends on the author experience and tastes.
A guideline: DRY is overrated or misunderstood. Favor simplicity instead of dryness at all costs.
Hope it helps