Techniques to Extremely slow plan

I have a scale test, I’m trying to create 300 instances, with 5 volumes each, and the associated attachments between them.

Roughly:

resource "instance" "i" {
  count = 300
}
resource "volume" "v" {
  count = 1500
}
resource "volume_attachment" {
  count = 1500
  instance_id = instance.i[floor(count.index / 5)].id
  volume_id = volume.v[count.index].id
}

Now if I exclude the attachments, I get a 16sec plan. But if I include them, I end up with a 28 minute plan.

I’ve tested having all the attachments go to a single instance and volume pair, I get a nice snappy plan.

Is there some way to tell terraform that it doesn’t have to walk all n*m resources while it’s planning? The best I can come up with is to convert my config to json template and have a script to generate all the resource groups without counts.

Anyone got a less terrible approach? This was supposed to be my medium size scale test, I don’t think I can justify going larger without a workaround.