From cfc6a162ac300d06b7a8b190388e200b8376b93f Mon Sep 17 00:00:00 2001 From: Krish Moodbidri <krish94@uab.edu> Date: Fri, 17 Nov 2023 13:38:26 -0600 Subject: [PATCH] feat: Attach multiple volumes to OpenHPC instance --- ohpc-instance/main.tf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ohpc-instance/main.tf b/ohpc-instance/main.tf index f968629..55ca660 100644 --- a/ohpc-instance/main.tf +++ b/ohpc-instance/main.tf @@ -26,7 +26,10 @@ variable "floating_ip_ohpc" {type = string} variable "ohpc_user" {} variable "ssh_private_key" {} -variable "vol_id" {} +variable "vol_ids" { + type = list(string) + default = [] +} # creates details for the OHPC instance resource "openstack_compute_instance_v2" "ohpc" { @@ -63,8 +66,9 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { # Attach a volume resource "openstack_compute_volume_attach_v2" "volume_attach" { + count = length(var.vol_ids) instance_id = openstack_compute_instance_v2.ohpc.id - volume_id = var.vol_id + volume_id = var.vol_ids[count.index] } output "xdmod_instance_id" { -- GitLab