fix(module): updating default values on virtualMachine
This commit is contained in:
parent
4a676480fb
commit
9f05f09e5d
|
@ -1,13 +1,6 @@
|
||||||
// Dependencies management
|
|
||||||
resource "null_resource" "depends_on" {
|
|
||||||
triggers = {
|
|
||||||
depends_on = join("", var.depends)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OpenNebula disk image !
|
// OpenNebula disk image !
|
||||||
resource "opennebula_image" "system" {
|
resource "opennebula_image" "system" {
|
||||||
name = var.system_image_name
|
name = local.system_image_name
|
||||||
description = "System disk image"
|
description = "System disk image"
|
||||||
datastore_id = var.one_prod_ds
|
datastore_id = var.one_prod_ds
|
||||||
persistent = false
|
persistent = false
|
||||||
|
@ -21,7 +14,7 @@ resource "opennebula_image" "system" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "opennebula_image" "data" {
|
resource "opennebula_image" "data" {
|
||||||
name = var.data_image_name
|
name = local.data_image_name
|
||||||
description = "Data disk image"
|
description = "Data disk image"
|
||||||
datastore_id = var.one_prod_ds
|
datastore_id = var.one_prod_ds
|
||||||
persistent = true
|
persistent = true
|
||||||
|
@ -78,12 +71,10 @@ resource "opennebula_template" "vm_template" {
|
||||||
|
|
||||||
// OpenNebula Virtual Machine
|
// OpenNebula Virtual Machine
|
||||||
resource "opennebula_virtual_machine" "vm" {
|
resource "opennebula_virtual_machine" "vm" {
|
||||||
name = var.vm_fqdn
|
name = local.fqdn
|
||||||
group = var.group
|
group = var.group
|
||||||
timeout = 10
|
|
||||||
template_id = opennebula_template.vm_template.id
|
template_id = opennebula_template.vm_template.id
|
||||||
depends_on = [ opennebula_template.vm_template,
|
depends_on = [ opennebula_template.vm_template ]
|
||||||
null_resource.depends_on ]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "dns_a_record_set" "vm_dns_a_record" {
|
resource "dns_a_record_set" "vm_dns_a_record" {
|
||||||
|
@ -102,7 +93,7 @@ resource "dns_cname_record" "vm_dns_cname_record" {
|
||||||
|
|
||||||
zone = var.vm_domain
|
zone = var.vm_domain
|
||||||
name = each.value
|
name = each.value
|
||||||
cname = "${var.vm_fqdn}."
|
cname = "${local.fqdn}."
|
||||||
ttl = 300
|
ttl = 300
|
||||||
|
|
||||||
depends_on = [ opennebula_virtual_machine.vm ]
|
depends_on = [ opennebula_virtual_machine.vm ]
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
output "virtual_machine_shortname" {
|
output "shortname" {
|
||||||
value = opennebula_virtual_machine.vm.name
|
value = opennebula_virtual_machine.vm.name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "virtual_machine_nic0_mac" {
|
output "fqdn" {
|
||||||
value = opennebula_virtual_machine.vm.nic[0].mac
|
value = var.vm_fqdn
|
||||||
|
}
|
||||||
|
|
||||||
|
output "first_nic_mac" {
|
||||||
|
value = opennebula_virtual_machine.vm.template_nic[0].computed_mac
|
||||||
}
|
}
|
||||||
|
|
||||||
output "network_interfaces" {
|
output "network_interfaces" {
|
||||||
|
|
|
@ -26,21 +26,25 @@ variable "vm_domain" {
|
||||||
variable "system_image_name" {
|
variable "system_image_name" {
|
||||||
description = "System image disk name"
|
description = "System image disk name"
|
||||||
type = string
|
type = string
|
||||||
|
default = "${var.vm_shortname}.system"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "system_image_source" {
|
variable "system_image_source" {
|
||||||
description = "Virtual Machine system image source"
|
description = "Virtual Machine system image source"
|
||||||
type = string
|
type = string
|
||||||
|
default = "https://marketplace.opennebula.io//appliance/251b0578-6c47-4ba4-b184-dc6e873201a2/download/0"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "data_image_name" {
|
variable "data_image_name" {
|
||||||
description = "Data image disk name"
|
description = "Data image disk name"
|
||||||
type = string
|
type = string
|
||||||
|
default = "${var.vm_shortname}.data"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "data_image_source" {
|
variable "data_image_source" {
|
||||||
description = "Virtual Machine data disk image source"
|
description = "Virtual Machine data disk image source"
|
||||||
type = string
|
type = string
|
||||||
|
default = "https://marketplace.opennebula.io//appliance/251b0578-6c47-4ba4-b184-dc6e873201a2/download/0"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "tag_labels" {
|
variable "tag_labels" {
|
||||||
|
|
Loading…
Reference in New Issue