Skip to content

Commit 058b482

Browse files
authored
fix: logic of additional EBS count (#10)
1 parent 94518a1 commit 058b482

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

main.tf

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,8 @@ resource "aws_ebs_volume" "default" {
160160
}
161161

162162
resource "aws_volume_attachment" "default" {
163-
count = signum(local.instance_count) == 1 ? var.ebs_volume_count * local.instance_count : 0
164-
165-
device_name = slice(
166-
var.ebs_device_names,
167-
0,
168-
floor(
169-
var.ebs_volume_count * local.instance_count / max(local.instance_count, 1),
170-
),
171-
)[count.index]
172-
163+
count = signum(local.instance_count) == 1 ? var.ebs_volume_count * local.instance_count : 0
164+
device_name = element(slice(var.ebs_device_names, 0, floor(var.ebs_volume_count * local.instance_count / max(local.instance_count, 1))), count.index)
173165
volume_id = aws_ebs_volume.default.*.id[count.index]
174166
instance_id = aws_instance.default.*.id[count.index]
175167
}

0 commit comments

Comments
 (0)