9 Commits

4 changed files with 21 additions and 20 deletions

View File

@ -0,0 +1,6 @@
locals {
fqdn = "${var.vm_shortname}.${var.vm_domain}"
system_image_name = "system.${local.fqdn}"
system_image_source = var.system_image_source
data_image_name = "data.${local.fqdn}"
}

View File

@ -1,3 +1,8 @@
resource "opennebula_group" "main" {
name = var.group
}
// OpenNebula disk image !
resource "opennebula_image" "system" {
name = local.system_image_name
@ -24,7 +29,7 @@ resource "opennebula_image" "data" {
driver = "qcow2"
format = "qcow2"
permissions = "660"
group = "production"
group = var.group
}
// OpenNebula (VM) Template definition
@ -52,6 +57,10 @@ resource "opennebula_template" "vm_template" {
image_id = opennebula_image.data.id
}
os {
arch = "x86_64"
boot = "disk0,nic0"
}
//labels = var.tag_labels
dynamic "nic" {

View File

@ -3,7 +3,7 @@ output "shortname" {
}
output "fqdn" {
value = var.vm_fqdn
value = local.fqdn
}
output "first_nic_mac" {

View File

@ -8,11 +8,6 @@ variable "one_prod_ds" {
type = string
}
variable "vm_fqdn" {
description = "Virtual Machine FQDN Name"
type = string
}
variable "vm_shortname" {
description = "Virtual machine short name"
type = string
@ -23,24 +18,12 @@ variable "vm_domain" {
type = string
}
variable "system_image_name" {
description = "System image disk name"
type = string
default = "${var.vm_shortname}.system"
}
variable "system_image_source" {
description = "Virtual Machine system image source"
type = string
default = "https://marketplace.opennebula.io//appliance/251b0578-6c47-4ba4-b184-dc6e873201a2/download/0"
}
variable "data_image_name" {
description = "Data image disk name"
type = string
default = "${var.vm_shortname}.data"
}
variable "data_image_source" {
description = "Virtual Machine data disk image source"
type = string
@ -60,16 +43,19 @@ variable "network_interfaces" {
variable "cpu" {
description = "VM CPU"
type = string
default = "0.2"
}
variable "vcpu" {
description = "VM vCPU"
type = string
default = "2"
}
variable "ram" {
description = "VM RAM"
type = string
default = "512"
}
variable "depends" {
@ -109,5 +95,5 @@ variable "graphics" {
variable "imagemode" {
description = "Disk image mode"
type = string
default = "0600"
default = "600"
}