93 lines
2.0 KiB
HCL
93 lines
2.0 KiB
HCL
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 ]
|
|
}
|
|
*/
|