iac/main.tf
Florian Maury 1b9eeb1288 blip
2025-01-10 16:10:39 +01:00

92 lines
2.3 KiB
HCL

terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
version = "~>0.56.1"
}
}
required_version = ">=1.6.2"
}
provider "proxmox" {
endpoint = var.pve_api_base_url
api_token = var.pve_api_token
}
module "netboot_server" {
source = "./modules/netboot_server"
hostname = "netboot_server"
prod_network_name = var.admin_network_name
dhcp_iface = "ens18"
dhcp_server_ip_addr = cidrhost(var.admin_network_prefix, 2)
dhcp_gateway = cidrhost(var.admin_network_prefix, 1)
dhcp_range = var.admin_network_prefix
ssh_public_key_opentofu_netboot_server = var.ssh_public_key_opentofu_netboot_server
pve_api_base_url = var.pve_api_base_url
pve_api_token = var.pve_api_token
pve_node_name = var.pve_node_name
pve_storage_id = var.pve_storage_id
pve_vm_id = 108
}
module "poc" {
depends_on = [ module.netboot_server ]
source = "./modules/poc"
pve_vm_id = 110
pve_storage_id = "local"
pve_node_name = "ns3152888"
pve_ssh_user = var.pve_ssh_user
pve_ssh_host = var.pve_ssh_host
netboot_server_ip_address = cidrhost(var.admin_network_prefix, 2)
admin_network = {
name = var.admin_network_name
prefix = var.admin_network_prefix
mac_address = "1c:69:7a:ff:ff:01"
}
prod_network = {
name = var.prod_network_name
prefix = var.prod_network_prefix
mac_address = "1c:69:7a:ef:ff:01"
}
monitoring_network = {
name = var.monit_network_name
prefix = var.monit_network_prefix
mac_address = "1c:69:7a:df:ff:01"
}
admin_ssh_public_key = var.ssh_public_key_admin_netboot_server
}
locals {
castopod_domain = "pod.broken-by-design.fr"
castopod_upstream_port = 8000
}
module "castopod_config" {
source = "./modules/castopod"
base_url = "https://pod.broken-by-design.fr/"
castopod_domain = local.castopod_domain
castopod_upstream_port = local.castopod_upstream_port
ssh_authorized_keys = [
file("/var/home/fmaury/.ssh/fma_ovh_rise2.pub")
]
}
module "caddy_config" {
source = "./modules/caddy_reverse"
vhosts = [
{
domain = local.castopod_domain
upstreams = [
"10.109.0.13:${local.castopod_upstream_port}"
]
}
]
ssh_authorized_keys = [
file("/var/home/fmaury/.ssh/fma_ovh_rise2.pub")
]
}