I need to add multiple scratch_disk clauses to a resource for a Google Cloud VM.
I can use the following...
resource ... {
dynamic "scratch_disk" {
for_each = var.scratch_disk_count
content {
interface = "SCSI"
}
}
}
but then var.scratch_disk_count needs to be [ 1, 2, 3, 4 ] which looks a bit silly.
I tried replacing for_each with count = 4 but terraform said it didn't expect count there.
Is there a function to produce [ 1, 2, 3, 4 ] from 4, or just some generally better way?
This is a simple characterisation of the problem - I understand I could have the list be [ "SCSI", "SCSI", "NVME" ] or similar.
Thanks.