Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow volumes to not be managed by Magic Castle (instead, use existing ones) #339

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add volume_id as a parameter to volumes
  • Loading branch information
mboisson committed Jan 15, 2025
commit 9f08d12bf0cc1ad3ea98c8759ec919648d53d163
6 changes: 4 additions & 2 deletions openstack/infrastructure.tf
Original file line number Diff line number Diff line change
@@ -98,7 +98,9 @@ resource "openstack_compute_instance_v2" "instances" {
}

resource "openstack_blockstorage_volume_v3" "volumes" {
for_each = module.design.volumes
for_each = {
for x, values in module.design.volumes : x => true if values.volume_id != undef
}
name = "${var.cluster_name}-${each.key}"
description = "${var.cluster_name} ${each.key}"
size = each.value.size
@@ -110,7 +112,7 @@ resource "openstack_blockstorage_volume_v3" "volumes" {
resource "openstack_compute_volume_attach_v2" "attachments" {
for_each = module.design.volumes
instance_id = openstack_compute_instance_v2.instances[each.value.instance].id
volume_id = openstack_blockstorage_volume_v3.volumes[each.key].id
volume_id = try(each.value.volume_id, openstack_blockstorage_volume_v3.volumes[each.key].id)
}

locals {