Skip to content
Snippets Groups Projects
Commit 4b53c40b authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

re-using code to attach volumes

parent 48a6cc18
No related branches found
No related tags found
No related merge requests found
Pipeline #10661 failed with stages
in 9 minutes and 59 seconds
...@@ -9,7 +9,6 @@ required_version = ">= 0.14.0" ...@@ -9,7 +9,6 @@ required_version = ">= 0.14.0"
} }
} }
variable "ohpc_instance_name" {} variable "ohpc_instance_name" {}
variable "image_ohpc" {} variable "image_ohpc" {}
variable "flavor" {} variable "flavor" {}
...@@ -76,16 +75,13 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" { ...@@ -76,16 +75,13 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" {
instance_id = openstack_compute_instance_v2.ohpc.id instance_id = openstack_compute_instance_v2.ohpc.id
} }
# Attach specific volumes # Attach volumes
resource "openstack_compute_volume_attach_v2" "attach_prod_volume" { resource "openstack_compute_volume_attach_v2" "volume_attach" {
count = length(var.vol_ids)
instance_id = openstack_compute_instance_v2.ohpc.id instance_id = openstack_compute_instance_v2.ohpc.id
volume_id = var.data_volume volume_id = var.vol_ids[count.index]
} }
resource "openstack_compute_volume_attach_v2" "attach_prod_queue_volume" {
instance_id = openstack_compute_instance_v2.ohpc.id
volume_id = var.prod_volume_id
}
output "xdmod_instance_id" { output "xdmod_instance_id" {
value = openstack_compute_instance_v2.ohpc.id value = openstack_compute_instance_v2.ohpc.id
} }
...@@ -96,7 +92,8 @@ output "ssh_host" { ...@@ -96,7 +92,8 @@ output "ssh_host" {
output "device" { output "device" {
value = [ value = [
openstack_compute_volume_attach_v2.attach_prod_volume.device, openstack_compute_volume_attach_v2.volume_attach[0].device,
openstack_compute_volume_attach_v2.attach_prod_queue_volume.device openstack_compute_volume_attach_v2.volume_attach[1].device,
] ]
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment