Terraform : dependency handling with the resources created using count or for_each

I have to create few resources of same type. So, I am using count/for_each for the same. Now, my requirement is like below.
The loop elements should be created sequentially because the second element depends on first one, the third element depends on second one and so on. I tried doing like below which didn’t work .
resource “confluent_environment” “confluent_kafka_environment” {
count = length(var.confluent_kafka_environment_name)
display_name = var.confluent_kafka_environment_name[count.index]
depends_on = [ confluent_environment.confluent_kafka_environment[count.index - 1] ]

Can someone please suggest how can I achieve it?
Waiting for the favorable response.
Thanks in advanced.

You can’t. Terraform’s dependency model just doesn’t allow expressing that.

Though, confluent_environment resources don’t seem to depend on each other as far as I can see, so that shouldn’t be an issue?

I have given confluent environment as an example. I have to implement it in some other resource. But I am not getting the ways to do it. Because if that type of dependency is not supported then if I have 10 or 20 list element then I have to write each block separately which I think not a good solution. Is there any other way to implement it ?

Terraform only supports dependencies between separate blocks. There’s no way around that.