The problem you have is Terraform is trying to assign a name to the object that is yet to be created, however, the name is made up of objects that don't exist yet. The Terraform address in for_each here would be module.ser["name-uuid"]. The uuid is the bit it doesn't know yet As suggested in the error message, there are two ways of solving it: