Skip to content

Commit 04afc3f

Browse files
committed
add lookup for existing volumes
1 parent 498bf7a commit 04afc3f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

openstack/infrastructure.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ resource "openstack_blockstorage_volume_v3" "volumes" {
108108
snapshot_id = lookup(each.value, "snapshot", null)
109109
enable_online_resize = lookup(each.value, "enable_resize", false)
110110
}
111+
data "openstack_blockstorage_volume_v3" "volumes" {
112+
for_each = {
113+
for x, values in module.design.volumes : x => values if contains(keys(values), "volume_id")
114+
}
115+
name = "${var.cluster_name}-${each.key}"
116+
}
111117

112118
resource "openstack_compute_volume_attach_v2" "attachments" {
113119
for_each = module.design.volumes

0 commit comments

Comments
 (0)