feat(nebula): adding multiple data disk support for Virtual Machines
This commit is contained in:
parent
75babdbff8
commit
18365fdf80
|
@ -32,6 +32,17 @@ variable "one_sys_datastore" {
|
||||||
default = "100"
|
default = "100"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
data_disks = flatten([
|
||||||
|
for vm_key, vm in var.vms : [
|
||||||
|
for disk in vm.data_disks : {
|
||||||
|
name = "${vm_key}.${vm.domain}-data-${disk.name}"
|
||||||
|
size = disk.size
|
||||||
|
persist = disk.persistent
|
||||||
|
}
|
||||||
|
]
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
// system image
|
// system image
|
||||||
resource "opennebula_image" "system" {
|
resource "opennebula_image" "system" {
|
||||||
|
@ -47,19 +58,22 @@ resource "opennebula_image" "system" {
|
||||||
permissions = var.permissions
|
permissions = var.permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
/* data image not needed now
|
|
||||||
resource "opennebula_image" "data" {
|
|
||||||
for_each = var.vms
|
|
||||||
|
|
||||||
name = "data-${each.key}.${each.value.domain}"
|
// data image not needed now
|
||||||
path = "https://vulcain.cadoles.com/empty_40G"
|
resource "opennebula_image" "data" {
|
||||||
|
for_each = {
|
||||||
|
for ds in local.data_disks : "${ds.vm_key}.${ds.name}" => ds
|
||||||
|
}
|
||||||
|
|
||||||
|
name = each.value.name
|
||||||
|
path = "https://vulcain.cadoles.com/empty_${each.value.size}"
|
||||||
datastore_id = var.one_image_ds
|
datastore_id = var.one_image_ds
|
||||||
description = "data disk for ${each.key}"
|
description = "Data disk of ${each.value.size} for ${each.value.vm_key}"
|
||||||
persistent = each.value.data_image_persistent
|
persistent = each.value.persist
|
||||||
format = var.image_format
|
format = var.image_format
|
||||||
dev_prefix = var.dev_prefix
|
dev_prefix = var.dev_prefix
|
||||||
permissions = var.permissions
|
permissions = var.permissions
|
||||||
}*/
|
}
|
||||||
|
|
||||||
resource "opennebula_template" "vm_template" {
|
resource "opennebula_template" "vm_template" {
|
||||||
for_each = var.vms
|
for_each = var.vms
|
||||||
|
|
Loading…
Reference in New Issue