I'm using a for_each to loop through the following variable:
networks = {
network1 = {
name = "NETWORK1"
},
network2 = {
name = "NETWORK2"
}
}
There is a dependency on the underlying API that a second network can only be created if the previous one has been created.
Therefore I wanted to use a depends_on in the below snippet:
resource "virtual_network" "network" {
depends_on = []
for_each = var.networks
parameters {
payload {
name = each.value.name
}
}
}
How can I make the network creation dependent on the previous iteration of the for_each loop?