My current Terraform is configured to build several AWS volumes which are all of the same size. A couple of our servers now require bigger volumes. Is it possible to create multiple volumes of different size in the same resource block?
Alternatively I'd have to split this block up (1 block per volume size), which would require me to rebuild a lot of my Terraform configuration i.e. in volume attachment section etc. I'd prefer to avoid this if possible.
I need the third and fourth volumes in the count to be of a bigger size. Initially I thought to use some conditional logic such as If/Else however I'm not sure how to implement this in terraform. I'm using terraform 0.12.18.
Pseudo-code:
resource "aws_ebs_volume""myvolume" { provider = aws.client count = 5 availability_zone = var.availability_zone encrypted = "true" size = if index aws_ebs_volume.myvolume = 2 or 3 then 300GB else 100GB type = "gp2"