Skip to content

Commit 78b7ba8

Browse files
committed
fix existing_volumes to use data.aws_ebs_volume
1 parent 547e07b commit 78b7ba8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aws/infrastructure.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ locals {
163163
resource "aws_volume_attachment" "attachments" {
164164
for_each = module.design.volumes
165165
device_name = local.device_names[index(module.design.volume_per_instance[each.value.instance], replace(each.key, "${each.value.instance}-", ""))]
166-
volume_id = try(aws_ebs_volume.volumes[each.key].id, aws_ebs_volume.existing_volumes[each.key].id)
166+
volume_id = try(aws_ebs_volume.volumes[each.key].id, data.aws_ebs_volume.existing_volumes[each.key].id)
167167
instance_id = aws_instance.instances[each.value.instance].id
168168
skip_destroy = true
169169
}
@@ -187,7 +187,7 @@ locals {
187187
pv_key => {
188188
for name, specs in pv_values:
189189
name => merge(
190-
{ glob = try("/dev/disk/by-id/*${replace(aws_ebs_volume.volumes["${x}-${pv_key}-${name}"].id, "-", "")}", "/dev/disk/by-id/*${replace(aws_ebs_volume.existing_volumes["${x}-${pv_key}-${name}"].id, "-", "")}") },
190+
{ glob = try("/dev/disk/by-id/*${replace(aws_ebs_volume.volumes["${x}-${pv_key}-${name}"].id, "-", "")}", "/dev/disk/by-id/*${replace(data.aws_ebs_volume.existing_volumes["${x}-${pv_key}-${name}"].id, "-", "")}") },
191191
specs,
192192
)
193193
} if contains(values.tags, pv_key)

0 commit comments

Comments
 (0)