From 9512b9907951ae81516711c05918ef79734bf2b7 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Mon, 22 Mar 2021 19:52:11 +0100 Subject: [PATCH] Begin --- terraform/main.tf | 92 + terraform/main.tfvars | 60 + terraform/modules/cadolesDNS/main.tf | 29 + terraform/modules/cadolesDNS/outputs.tf | 0 terraform/modules/cadolesDNS/variables.tf | 23 + terraform/modules/virtualMachine/main.tf | 115 + terraform/modules/virtualMachine/outputs.tf | 7 + terraform/modules/virtualMachine/variables.tf | 87 + terraform/modules/virtualMachine/versions.tf | 15 + terraform/templates/groups/standard.tpl | 4 + terraform/terraform.tfstate | 2194 +++++++++++++++++ terraform/variables.tf | 76 + terraform/version.tf | 11 + 13 files changed, 2713 insertions(+) create mode 100644 terraform/main.tf create mode 100644 terraform/main.tfvars create mode 100644 terraform/modules/cadolesDNS/main.tf create mode 100644 terraform/modules/cadolesDNS/outputs.tf create mode 100644 terraform/modules/cadolesDNS/variables.tf create mode 100644 terraform/modules/virtualMachine/main.tf create mode 100644 terraform/modules/virtualMachine/outputs.tf create mode 100644 terraform/modules/virtualMachine/variables.tf create mode 100644 terraform/modules/virtualMachine/versions.tf create mode 100644 terraform/templates/groups/standard.tpl create mode 100644 terraform/terraform.tfstate create mode 100644 terraform/variables.tf create mode 100644 terraform/version.tf diff --git a/terraform/main.tf b/terraform/main.tf new file mode 100644 index 0000000..ff88288 --- /dev/null +++ b/terraform/main.tf @@ -0,0 +1,92 @@ +provider "opennebula" { + endpoint = var.one_endpoint + username = var.one_user + password = var.one_pass +} + +provider "dns" { + update { + server = var.dns_server + port = "53530" + key_name = var.dns_key_name + key_algorithm = var.dns_key_algo + key_secret = var.dns_key_secret + retries = 10 + timeout = 300 + } +} + + +// Production + +/* + * Virtual networks + */ +resource "opennebula_virtual_network" "vnet"{ + for_each = var.virtual_networks + name = each.key + vlan_id = each.value.vlan_id + permissions = "660" + bridge = var.one_vswitch + type = "ovswitch" + mtu = 1500 + ar { + ar_type = each.value.adress_range.ar_type + size = each.value.adress_range.size + ip4 = each.value.adress_range.ip4 + } + dns = each.value.dns + gateway = each.value.gateway + clusters = each.value.clusters +} + +/* + * VIRTUAL MACHINES + */ + +// Production + +/* Amon +module "amon" { + source = "./modules/virtualMachine" + one_user = var.one_user + one_prod_ds = var.one_prod_ds + + vm_shortname = "amon" + vm_fqdn = "amon.ber.asso.fr" + vm_domain = var.dns_domain + dns_a_record = "no" + + cpu = 0.4 + vcpu = 4 + ram = 4096 + network_interfaces = [ + { network_id = opennebula_virtual_network.internet.id, ip = "192.168.1.2"}, + { network_id = opennebula_virtual_network.production.id, ip = "192.168.5.254"}, + { network_id = opennebula_virtual_network.office.id, ip = "192.168.10.254"}, + ] + + tag_labels = "Production,Infrastructure,Amon,Firewall,EOLE" + + system_image_name = "PROD-AMON-STATIC" + data_image_name = "" + + system_image_source = "http://hapy-ber.ber.asso.fr/factory/ber/production/amon.ber.asso.fr/system/amon.ber.asso.fr_latest.img" + data_image_source = "" + + depends = [ + opennebula_virtual_network.production.id + ] +} + + + +/* Additionnal DNS Entry +module "ber_asso_fr" { + source = "./modules/cadolesDNS" + dns_domain = "cadoles.com." + dns_a_records = var.dns_a_records + dns_cname_records = var.dns_cname_records + depends = [ module.dns.virtual_machine_shortname ] +} +*/ diff --git a/terraform/main.tfvars b/terraform/main.tfvars new file mode 100644 index 0000000..8554fdd --- /dev/null +++ b/terraform/main.tfvars @@ -0,0 +1,60 @@ +one_endpoint = "https://hapy-ber.ber.asso.fr/RPC2" +one_user = "terra" +one_pass = "198fdd93f0772814b97d25833662b165ee74a83158bcba0d7f8172de6a26e79c" +one_vswitch = "vswitch" +one_prod_ds = "101" +image_builder_ip = "192.168.1.108" +dns_server = "192.168.5.53" +cluster_id = 0 +dns_domain = "ber.asso.fr." + +dns_key_name = "terra.cadoles.com." +dns_key_secret = "iBmRl+hYOR1k455+jy9Cfbwu5W/vawqTezllDoOKyts=" + +dns_zones = [ + { + domain = "cadoles.com", + a_records = { + hapy = [ "192.168.1.108" ], + amon = [ "192.168.1.1"] + }, + cname_records = { + hapy = "virt.cadoles.com." + } + }, + { + domain = "cadol.es", + a_records = { + hapy = [ "192.168.1.108" ], + amon = [ "192.168.1.1"] + }, + cname_records = { + hapy = "virt.cadol.es." + } + } +] + +virtual_networks = { + internet = { + vlan_id = "4", + adress_range = { + ar_type = "IP4", + size = "10", + ip4 = "192.168.1.2" + }, + dns = "192.168.5.53", + gateway = "192.168.1.1", + clusters = [ "1" ] + }, + office = { + vlan_id = "10", + adress_range = { + ar_type = "IP4", + size = "30", + ip4 = "192.168.10.100" + }, + dns = "192.168.5.53", + gateway = "192.168.10.254", + clusters = [ "1" ] + } +} diff --git a/terraform/modules/cadolesDNS/main.tf b/terraform/modules/cadolesDNS/main.tf new file mode 100644 index 0000000..be8ca7f --- /dev/null +++ b/terraform/modules/cadolesDNS/main.tf @@ -0,0 +1,29 @@ +// Dependencies management +resource "null_resource" "depends_on" { + triggers = { + depends_on = join("", var.depends) + } +} + + +resource "dns_a_record_set" "a_records" { + for_each = var.dns_a_records + + zone = var.dns_domain + name = each.key + ttl = 300 + + addresses = each.value + depends_on = [ null_resource.depends_on ] +} + +resource "dns_cname_record" "cname_records" { + for_each = var.dns_cname_records + + zone = var.dns_domain + name = each.key + cname = each.value + ttl = 300 + + depends_on = [ null_resource.depends_on ] +} diff --git a/terraform/modules/cadolesDNS/outputs.tf b/terraform/modules/cadolesDNS/outputs.tf new file mode 100644 index 0000000..e69de29 diff --git a/terraform/modules/cadolesDNS/variables.tf b/terraform/modules/cadolesDNS/variables.tf new file mode 100644 index 0000000..9f9f51c --- /dev/null +++ b/terraform/modules/cadolesDNS/variables.tf @@ -0,0 +1,23 @@ +variable "dns_domain" { + description = "DNS Domain name (FQDN)" + type = string + default = "cadoles.com." +} + +variable "dns_a_records" { + description = "List of dns A records to create" + type = map + default = {} +} + +variable "dns_cname_records" { + description = "List of CNAME entires" + type = map + default = {} +} + +variable "depends" { + description = "List of output_variables for dependences management" + type = list + default = [] +} \ No newline at end of file diff --git a/terraform/modules/virtualMachine/main.tf b/terraform/modules/virtualMachine/main.tf new file mode 100644 index 0000000..0e06c65 --- /dev/null +++ b/terraform/modules/virtualMachine/main.tf @@ -0,0 +1,115 @@ +// Dependencies management +resource "null_resource" "depends_on" { + triggers = { + depends_on = join("", var.depends) + } +} + +// OpenNebula disk image ! +resource "opennebula_image" "system" { + name = var.system_image_name + description = "System disk image" + datastore_id = var.one_prod_ds + //persistent = false + persistent = true + //lock = "MANAGE" + path = var.system_image_source + dev_prefix = "vd" + driver = "qcow2" + format = "qcow2" + permissions = "660" + group = "production" +} + +resource "opennebula_image" "data" { + name = var.data_image_name + description = "Data disk image" + datastore_id = var.one_prod_ds + persistent = true + //lock = "MANAGE" + path = var.data_image_source + dev_prefix = "vd" + driver = "qcow2" + format = "qcow2" + permissions = "660" + group = "production" + count = var.data_image_name != "" ? 1 : 0 +} + +// OpenNebula (VM) Template definition +resource "opennebula_template" "vm_template" { + name = var.vm_shortname + cpu = var.cpu + vcpu = var.vcpu + memory = var.ram + graphics { + keymap = "fr" + listen = "0.0.0.0" + type = "VNC" + } + context = { + DNS_HOSTNAME = "yes" + NETWORK = "YES" + SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + USERNAME = "root" + } + + disk { + image_id = opennebula_image.system.id + } + + dynamic "disk" { + for_each = opennebula_image.data + content { + image_id = disk.id + } + } + + //labels = var.tag_labels + + dynamic "nic" { + for_each = var.network_interfaces + + content { + network_id = nic.value.network_id + model = "virtio" + ip = nic.value.ip + } + } + permissions = "600" + group = "production" + depends_on = [ opennebula_image.system, + opennebula_image.data ] +} + +// OpenNebula Virtual Machine +resource "opennebula_virtual_machine" "vm" { + name = var.vm_fqdn + group = "production" + timeout = 10 + template_id = opennebula_template.vm_template.id + depends_on = [ opennebula_template.vm_template, + null_resource.depends_on ] +} + +resource "dns_a_record_set" "vm_dns_a_record" { + count = var.dns_a_record == "yes" ? 1 : 0 + + zone = var.vm_domain + name = var.vm_shortname + ttl = 300 + + addresses = [ var.network_interfaces[0].ip ] + depends_on = [ opennebula_virtual_machine.vm ] +} + +resource "dns_cname_record" "vm_dns_cname_record" { + for_each = var.dns_cname_record + + zone = var.vm_domain + name = each.value + cname = "${var.vm_fqdn}." + ttl = 300 + + depends_on = [ opennebula_virtual_machine.vm ] +} diff --git a/terraform/modules/virtualMachine/outputs.tf b/terraform/modules/virtualMachine/outputs.tf new file mode 100644 index 0000000..26c74dc --- /dev/null +++ b/terraform/modules/virtualMachine/outputs.tf @@ -0,0 +1,7 @@ +output "virtual_machine_shortname" { + value = opennebula_virtual_machine.vm.name +} + +output "network_interfaces" { + value = var.network_interfaces +} \ No newline at end of file diff --git a/terraform/modules/virtualMachine/variables.tf b/terraform/modules/virtualMachine/variables.tf new file mode 100644 index 0000000..bb53bf9 --- /dev/null +++ b/terraform/modules/virtualMachine/variables.tf @@ -0,0 +1,87 @@ +variable "one_user" { + description = "OpenNebula user" + type = string +} + +variable "one_prod_ds" { + description = "ID du Datastore de production" + type = string +} + +variable "vm_fqdn" { + description = "Virtual Machine FQDN Name" + type = string +} + +variable "vm_shortname" { + description = "Virtual machine short name" + type = string +} + +variable "vm_domain" { + description = "Full qualified dns domain name" + type = string +} + +variable "system_image_name" { + description = "System image disk name" + type = string +} + +variable "system_image_source" { + description = "Virtual Machine system image source" + type = string +} + +variable "data_image_name" { + description = "Data image disk name" + type = string +} + +variable "data_image_source" { + description = "Virtual Machine data disk image source" + type = string +} + +variable "tag_labels" { + description = "Labels" + type = string +} + +variable "network_interfaces" { + description = "Network interfaces" + type = list +} + +variable "cpu" { + description = "VM CPU" + type = string +} + +variable "vcpu" { + description = "VM vCPU" + type = string +} + +variable "ram" { + description = "VM RAM" + type = string +} + +variable "depends" { + description = "List of output_variables for dependences management" + type = list + default = [] +} + +variable "dns_a_record" { + description = "Create a dns A record (yes/no)" + type = string + default = "no" +} + +variable "dns_cname_record" { + description = "List of CNAME for A entry" + type = map(string) + default = {} +} \ No newline at end of file diff --git a/terraform/modules/virtualMachine/versions.tf b/terraform/modules/virtualMachine/versions.tf new file mode 100644 index 0000000..a983d4a --- /dev/null +++ b/terraform/modules/virtualMachine/versions.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + dns = { + source = "hashicorp/dns" + } + null = { + source = "hashicorp/null" + } + opennebula = { + source = "OpenNebula/opennebula" + version = "0.3.0" + } + } + required_version = ">= 0.13" +} diff --git a/terraform/templates/groups/standard.tpl b/terraform/templates/groups/standard.tpl new file mode 100644 index 0000000..1f3b9a7 --- /dev/null +++ b/terraform/templates/groups/standard.tpl @@ -0,0 +1,4 @@ +SUNSTONE = [ + DEFAULT_VIEW = "${group_default_view}", + VIEWS = "group_views" +] \ No newline at end of file diff --git a/terraform/terraform.tfstate b/terraform/terraform.tfstate new file mode 100644 index 0000000..c27b863 --- /dev/null +++ b/terraform/terraform.tfstate @@ -0,0 +1,2194 @@ +{ + "version": 4, + "terraform_version": "0.14.5", + "serial": 255, + "lineage": "3c0a2b66-37c7-52fb-dbdb-b8b2a18f1579", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "opennebula_group", + "name": "production", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "admins": [], + "delete_on_destruction": true, + "id": "108", + "name": "production", + "quotas": [], + "template": "SUNSTONE = [\n DEFAULT_VIEW = \"cloud\",\n VIEWS = \"group_views\"\n]", + "users": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "opennebula_virtual_network", + "name": "internet", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "ar": [ + { + "ar_type": "IP4", + "global_prefix": "", + "ip4": "192.168.1.2", + "ip6": "", + "mac": "", + "prefix_length": "", + "size": 10, + "ula_prefix": "" + } + ], + "automatic_vlan_id": null, + "bridge": "vswitch", + "clusters": [ + 0 + ], + "description": null, + "dns": "1.1.1.1", + "gateway": "192.168.1.1", + "gid": 108, + "gname": "production", + "group": "production", + "guest_mtu": 1500, + "hold_ips": null, + "hold_size": null, + "id": "28", + "ip_hold": null, + "mtu": 1500, + "name": "internet", + "network_mask": null, + "permissions": "660", + "physical_device": "", + "reservation_size": null, + "reservation_vnet": null, + "security_groups": [ + 0 + ], + "tags": null, + "type": "ovswitch", + "uid": 3, + "uname": "terra", + "vlan_id": "1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "opennebula_virtual_network", + "name": "office", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "ar": [ + { + "ar_type": "IP4", + "global_prefix": "", + "ip4": "192.168.10.250", + "ip6": "", + "mac": "", + "prefix_length": "", + "size": 5, + "ula_prefix": "" + } + ], + "automatic_vlan_id": null, + "bridge": "vswitch", + "clusters": [ + 0 + ], + "description": null, + "dns": "192.168.5.53", + "gateway": "192.168.10.254", + "gid": 108, + "gname": "production", + "group": "production", + "guest_mtu": 1500, + "hold_ips": null, + "hold_size": null, + "id": "29", + "ip_hold": null, + "mtu": 1500, + "name": "office", + "network_mask": "255.255.255.0", + "permissions": "660", + "physical_device": "", + "reservation_size": null, + "reservation_vnet": null, + "security_groups": [ + 0 + ], + "tags": null, + "type": "ovswitch", + "uid": 3, + "uname": "terra", + "vlan_id": "10" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "opennebula_virtual_network", + "name": "production", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "ar": [ + { + "ar_type": "IP4", + "global_prefix": "", + "ip4": "192.168.5.50", + "ip6": "", + "mac": "", + "prefix_length": "", + "size": 205, + "ula_prefix": "" + } + ], + "automatic_vlan_id": null, + "bridge": "vswitch", + "clusters": [ + 0 + ], + "description": null, + "dns": "192.168.5.53", + "gateway": "192.168.5.254", + "gid": 108, + "gname": "production", + "group": "production", + "guest_mtu": 1500, + "hold_ips": null, + "hold_size": null, + "id": "27", + "ip_hold": null, + "mtu": 1500, + "name": "production", + "network_mask": "255.255.255.0", + "permissions": "660", + "physical_device": "", + "reservation_size": null, + "reservation_vnet": null, + "security_groups": [ + 0 + ], + "tags": null, + "type": "ovswitch", + "uid": 3, + "uname": "terra", + "vlan_id": "5" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.dokuwiki", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "8356607493946833214", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.dokuwiki", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "32", + "lock": null, + "name": "PROD-dokuwiki-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/dokuwiki.ber.asso.fr/system/dokuwiki.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.dokuwiki", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 32, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "30", + "memory": 2048, + "name": "dokuwiki", + "nic": [ + { + "ip": "192.168.5.235", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471612, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"32\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.235\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.dokuwiki.opennebula_image.data", + "module.dokuwiki.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.dokuwiki", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 51200, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 32, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5914", + "type": "VNC" + } + ], + "group": "production", + "id": "14", + "instance": null, + "ip": "192.168.5.235", + "lcmstate": 3, + "memory": null, + "name": "dokuwiki.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.235", + "computed_mac": "02:00:c0:a8:05:eb", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 30, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.dokuwiki.null_resource.depends_on", + "module.dokuwiki.opennebula_image.data", + "module.dokuwiki.opennebula_image.system", + "module.dokuwiki.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.dolibarr", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "7777498855337090720", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.dolibarr", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "28", + "lock": null, + "name": "PROD-DOLIBARR-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/dolibarr.ber.asso.fr/system/dolibarr.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.dolibarr", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 28, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "33", + "memory": 2048, + "name": "dolibarr", + "nic": [ + { + "ip": "192.168.5.232", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471641, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"28\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.232\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.dolibarr.opennebula_image.data", + "module.dolibarr.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.dolibarr", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 51200, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 28, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5919", + "type": "VNC" + } + ], + "group": "production", + "id": "19", + "instance": null, + "ip": "192.168.5.232", + "lcmstate": 3, + "memory": null, + "name": "dolibarr.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.232", + "computed_mac": "02:00:c0:a8:05:e8", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 33, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.dolibarr.null_resource.depends_on", + "module.dolibarr.opennebula_image.data", + "module.dolibarr.opennebula_image.system", + "module.dolibarr.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.jorani", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "8174108748668961538", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.jorani", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "26", + "lock": null, + "name": "PROD-jorani-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/jorani.ber.asso.fr/system/jorani.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.jorani", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 26, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "26", + "memory": 2048, + "name": "jorani", + "nic": [ + { + "ip": "192.168.5.236", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471612, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"26\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.236\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.jorani.opennebula_image.data", + "module.jorani.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.jorani", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 51200, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 26, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5912", + "type": "VNC" + } + ], + "group": "production", + "id": "12", + "instance": null, + "ip": "192.168.5.236", + "lcmstate": 3, + "memory": null, + "name": "jorani.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.236", + "computed_mac": "02:00:c0:a8:05:ec", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 26, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.jorani.null_resource.depends_on", + "module.jorani.opennebula_image.data", + "module.jorani.opennebula_image.system", + "module.jorani.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.limesurvey", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "8814848728244353128", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.limesurvey", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "31", + "lock": null, + "name": "PROD-limesurvey-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/limesurvey.ber.asso.fr/system/limesurvey.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.limesurvey", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 31, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "34", + "memory": 2048, + "name": "limesurvey", + "nic": [ + { + "ip": "192.168.5.233", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471641, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"31\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.233\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.limesurvey.opennebula_image.data", + "module.limesurvey.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.limesurvey", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 51200, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 31, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5920", + "type": "VNC" + } + ], + "group": "production", + "id": "20", + "instance": null, + "ip": "192.168.5.233", + "lcmstate": 3, + "memory": null, + "name": "limesurvey.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.233", + "computed_mac": "02:00:c0:a8:05:e9", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 34, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.limesurvey.null_resource.depends_on", + "module.limesurvey.opennebula_image.data", + "module.limesurvey.opennebula_image.system", + "module.limesurvey.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.nextcloud", + "mode": "managed", + "type": "dns_a_record_set", + "name": "vm_dns_a_record", + "provider": "provider[\"registry.terraform.io/hashicorp/dns\"]", + "instances": [] + }, + { + "module": "module.nextcloud", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "2019882531658326180", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.nextcloud", + "mode": "managed", + "type": "opennebula_image", + "name": "data", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [] + }, + { + "module": "module.nextcloud", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [] + }, + { + "module": "module.nextcloud", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [] + }, + { + "module": "module.nineboard", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "880883751468971489", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.nineboard", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "29", + "lock": null, + "name": "PROD-nineboard-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/nineboard.ber.asso.fr/system/nineboard.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.nineboard", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 29, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "28", + "memory": 2048, + "name": "nineboard", + "nic": [ + { + "ip": "192.168.5.237", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471612, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"29\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.237\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.nineboard.opennebula_image.data", + "module.nineboard.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.nineboard", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 51200, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 29, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5915", + "type": "VNC" + } + ], + "group": "production", + "id": "15", + "instance": null, + "ip": "192.168.5.237", + "lcmstate": 3, + "memory": null, + "name": "nineboard.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.237", + "computed_mac": "02:00:c0:a8:05:ed", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 28, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.nineboard.null_resource.depends_on", + "module.nineboard.opennebula_image.data", + "module.nineboard.opennebula_image.system", + "module.nineboard.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.ninegate", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "3652821066007781642", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.ninegate", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "34", + "lock": null, + "name": "PROD-NINEGATE-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/ninegate.ber.asso.fr/system/ninegate.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.ninegate", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 34, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "32", + "memory": 4096, + "name": "ninegate", + "nic": [ + { + "ip": "192.168.5.240", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471612, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"34\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"4096\"\nNIC=[\n IP=\"192.168.5.240\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.ninegate.opennebula_image.data", + "module.ninegate.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.ninegate", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 51200, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 34, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5918", + "type": "VNC" + } + ], + "group": "production", + "id": "18", + "instance": null, + "ip": "192.168.5.240", + "lcmstate": 3, + "memory": null, + "name": "ninegate.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.240", + "computed_mac": "02:00:c0:a8:05:f0", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 32, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.ninegate.null_resource.depends_on", + "module.ninegate.opennebula_image.data", + "module.ninegate.opennebula_image.system", + "module.ninegate.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.piwigo", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "3526177936943702945", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.piwigo", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "30", + "lock": null, + "name": "PROD-piwigo-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/piwigo.ber.asso.fr/system/piwigo.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.piwigo", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 30, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "29", + "memory": 2048, + "name": "piwigo", + "nic": [ + { + "ip": "192.168.5.234", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471612, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"30\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.234\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.piwigo.opennebula_image.data", + "module.piwigo.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.piwigo", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 51200, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 30, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5916", + "type": "VNC" + } + ], + "group": "production", + "id": "16", + "instance": null, + "ip": "192.168.5.234", + "lcmstate": 3, + "memory": null, + "name": "piwigo.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.234", + "computed_mac": "02:00:c0:a8:05:ea", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 29, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.piwigo.null_resource.depends_on", + "module.piwigo.opennebula_image.data", + "module.piwigo.opennebula_image.system", + "module.piwigo.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.sso", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "3316862501330127771", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.sso", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "27", + "lock": null, + "name": "PROD-SSO-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/sso.ber.asso.fr/system/sso.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.sso", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 27, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "27", + "memory": 2048, + "name": "sso", + "nic": [ + { + "ip": "192.168.5.252", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471612, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"27\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.252\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.sso.opennebula_image.data", + "module.sso.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.sso", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [ + { + "computed_driver": "qcow2", + "computed_size": 20480, + "computed_target": "vda", + "disk_id": 0, + "driver": "", + "image_id": 27, + "size": 0, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "5913", + "type": "VNC" + } + ], + "group": "production", + "id": "13", + "instance": null, + "ip": "192.168.5.252", + "lcmstate": 3, + "memory": null, + "name": "sso.ber.asso.fr", + "nic": [ + { + "computed_ip": "192.168.5.252", + "computed_mac": "02:00:c0:a8:05:fc", + "computed_model": "virtio", + "computed_physical_device": "", + "computed_security_groups": [ + 0 + ], + "ip": "", + "mac": "", + "model": "", + "network": "production", + "network_id": 27, + "nic_id": 0, + "physical_device": "", + "security_groups": [] + } + ], + "os": null, + "pending": false, + "permissions": "600", + "state": 3, + "tags": null, + "template_id": 27, + "timeout": 10, + "uid": 3, + "uname": "terra", + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.sso.null_resource.depends_on", + "module.sso.opennebula_image.data", + "module.sso.opennebula_image.system", + "module.sso.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.syspass", + "mode": "managed", + "type": "dns_a_record_set", + "name": "vm_dns_a_record", + "provider": "provider[\"registry.terraform.io/hashicorp/dns\"]", + "instances": [] + }, + { + "module": "module.syspass", + "mode": "managed", + "type": "null_resource", + "name": "depends_on", + "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "3660615040052792267", + "triggers": { + "depends_on": "27" + } + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.syspass", + "mode": "managed", + "type": "opennebula_image", + "name": "data", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [] + }, + { + "module": "module.syspass", + "mode": "managed", + "type": "opennebula_image", + "name": "system", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "clone_from_image": null, + "datastore_id": 101, + "description": "System disk image", + "dev_prefix": "vd", + "driver": "qcow2", + "format": "qcow2", + "gid": 108, + "gname": "production", + "group": "production", + "id": "33", + "lock": null, + "name": "PROD-SYSPASS-STATIC", + "path": "http://hapy-ber.ber.asso.fr/factory/ber/production/syspass.ber.asso.fr/system/syspass.ber.asso.fr_latest.img", + "permissions": "660", + "persistent": true, + "size": null, + "tags": null, + "target": null, + "timeout": 10, + "type": null, + "uid": 3, + "uname": "terra" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "module": "module.syspass", + "mode": "managed", + "type": "opennebula_template", + "name": "vm_template", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "context": { + "DNS_HOSTNAME": "yes", + "NETWORK": "YES", + "SSH_PUBLIC_KEY": "$USER[SSH_PUBLIC_KEY]", + "USERNAME": "root" + }, + "cpu": 0.4, + "disk": [ + { + "driver": "", + "image_id": 33, + "size": -1, + "target": "" + } + ], + "gid": 108, + "gname": "production", + "graphics": [ + { + "keymap": "fr", + "listen": "0.0.0.0", + "port": "", + "type": "VNC" + } + ], + "group": "production", + "id": "31", + "memory": 2048, + "name": "syspass", + "nic": [ + { + "ip": "192.168.5.239", + "mac": "", + "model": "virtio", + "network": "", + "network_id": 27, + "physical_device": "", + "security_groups": [ + 0 + ] + } + ], + "os": null, + "permissions": "600", + "reg_time": 1613471612, + "tags": null, + "template": "CONTEXT=[\n DNS_HOSTNAME=\"yes\",\n NETWORK=\"YES\",\n SSH_PUBLIC_KEY=\"$USER[SSH_PUBLIC_KEY]\",\n USERNAME=\"root\" ]\nCPU=\"0.400000\"\nDISK=[\n IMAGE_ID=\"33\" ]\nGRAPHICS=[\n KEYMAP=\"fr\",\n LISTEN=\"0.0.0.0\",\n TYPE=\"VNC\" ]\nMEMORY=\"2048\"\nNIC=[\n IP=\"192.168.5.239\",\n MODEL=\"virtio\",\n NETWORK_ID=\"27\" ]\nVCPU=\"4\"", + "uid": 3, + "uname": "terra", + "vcpu": 4, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.syspass.opennebula_image.data", + "module.syspass.opennebula_image.system", + "opennebula_virtual_network.production" + ] + } + ] + }, + { + "module": "module.syspass", + "mode": "managed", + "type": "opennebula_virtual_machine", + "name": "vm", + "provider": "provider[\"registry.terraform.io/opennebula/opennebula\"]", + "instances": [ + { + "status": "tainted", + "schema_version": 0, + "attributes": { + "context": null, + "cpu": null, + "disk": [], + "gid": null, + "gname": null, + "graphics": null, + "group": "production", + "id": "17", + "instance": null, + "ip": null, + "lcmstate": null, + "memory": null, + "name": "syspass.ber.asso.fr", + "nic": [], + "os": null, + "pending": false, + "permissions": null, + "state": null, + "tags": null, + "template_id": 31, + "timeout": 10, + "uid": null, + "uname": null, + "vcpu": null, + "vmgroup": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "module.syspass.null_resource.depends_on", + "module.syspass.opennebula_image.data", + "module.syspass.opennebula_image.system", + "module.syspass.opennebula_template.vm_template", + "opennebula_virtual_network.production" + ] + } + ] + } + ] +} diff --git a/terraform/variables.tf b/terraform/variables.tf new file mode 100644 index 0000000..9ad8df0 --- /dev/null +++ b/terraform/variables.tf @@ -0,0 +1,76 @@ +/* + * Variables + */ + +variable "one_endpoint" { + description = "OpenNebula endpoint" + type = string +} + +variable "one_user" { + description = "OpenNebula user" + type = string +} + +variable "one_pass" { + description = "OpenNebula password" + type = string +} + +variable "one_vswitch" { + description = "OpenvSwitch bridge name" + type = string +} +variable "dns_server" { + description = "DNS Server IP" + type = string +} + +variable "cluster_id" { + description = "Cadoles ONE cluster ID" + type = string +} + +variable "one_prod_ds" { + description = "ID du Datastore de production" + type = string +} + +variable "dns_domain" { + description = "DNS Full qualified domain" + type = string +} + +variable "dns_key_name" { + description = "DDNS Key name" + type = string +} + +variable "dns_key_algo" { + description = "DDNS Key algorithm" + type = string + default = "hmac-sha256" +} + +variable "dns_key_secret" { + description = "DDNS Key secret" + type = string +} + +variable "dns_zones" { + description = "DNS Zone description" + type = list + default = [] +} + +variable "image_builder_ip" { + description = "Image builder IP" + type = string + default = "192.168.5.251" +} + +variable "virtual_networks" { + description = "OpenNebula virtual networks definition" + type = map + default = {} +} \ No newline at end of file diff --git a/terraform/version.tf b/terraform/version.tf new file mode 100644 index 0000000..67a5e3d --- /dev/null +++ b/terraform/version.tf @@ -0,0 +1,11 @@ +terraform { + required_providers { + dns = { + source = "hashicorp/dns" + } + opennebula = { + source = "opennebula/opennebula" + } + } + required_version = ">= 0.13" +} \ No newline at end of file