From 0f8112dced3c218af1d5c638cd14e6b88c7d5b20 Mon Sep 17 00:00:00 2001 From: Tine Date: Sun, 3 Nov 2024 11:28:09 +0100 Subject: [PATCH] docs: subnets --- README.md | 30 +++++++++++++-------------- terraform/node.tf | 52 ++++++++--------------------------------------- 2 files changed, 23 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 7deff96..00679f8 100644 --- a/README.md +++ b/README.md @@ -18,21 +18,21 @@ __network.tjo.cloud__ establishes Tailscale VPN connection between other network | Host | IPv4 | IPv6 | |---------|---------------|-----------------------| -| batuu | 10.0.0.16/20 | fd9b:5314:0:1000::/52 | -| jakku | 10.0.0.32/20 | fd9b:5314:0:2000::/52 | -| nevaroo | 10.0.0.48/20 | fd9b:5314:0:3000::/52 | -| | 10.0.0.64/20 | fd9b:5314:0:4000::/52 | -| | 10.0.0.80/20 | fd9b:5314:0:5000::/52 | -| | 10.0.0.96/20 | fd9b:5314:0:6000::/52 | -| | 10.0.0.112/20 | fd9b:5314:0:7000::/52 | -| | 10.0.0.128/20 | fd9b:5314:0:8000::/52 | -| | 10.0.0.144/20 | fd9b:5314:0:9000::/52 | -| | 10.0.0.160/20 | fd9b:5314:0:a000::/52 | -| | 10.0.0.176/20 | fd9b:5314:0:b000::/52 | -| | 10.0.0.192/20 | fd9b:5314:0:c000::/52 | -| | 10.0.0.208/20 | fd9b:5314:0:d000::/52 | -| | 10.0.0.224/20 | fd9b:5314:0:e000::/52 | -| | 10.0.0.240/20 | fd9b:5314:0:f000::/52 | +| batuu | 10.0.16.0/20 | fd9b:5314:0:1000::/52 | +| jakku | 10.0.32.0/20 | fd9b:5314:0:2000::/52 | +| nevaroo | 10.0.48.0/20 | fd9b:5314:0:3000::/52 | +| | 10.0.64.0/20 | fd9b:5314:0:4000::/52 | +| | 10.0.80.0/20 | fd9b:5314:0:5000::/52 | +| | 10.0.96.0/20 | fd9b:5314:0:6000::/52 | +| | 10.0.112.0/20 | fd9b:5314:0:7000::/52 | +| | 10.0.128.0/20 | fd9b:5314:0:8000::/52 | +| | 10.0.144.0/20 | fd9b:5314:0:9000::/52 | +| | 10.0.160.0/20 | fd9b:5314:0:a000::/52 | +| | 10.0.176.0/20 | fd9b:5314:0:b000::/52 | +| | 10.0.192.0/20 | fd9b:5314:0:c000::/52 | +| | 10.0.208.0/20 | fd9b:5314:0:d000::/52 | +| | 10.0.224.0/20 | fd9b:5314:0:e000::/52 | +| | 10.0.240.0/20 | fd9b:5314:0:f000::/52 | # Setting up new Host diff --git a/terraform/node.tf b/terraform/node.tf index 68c7b4c..24ed926 100644 --- a/terraform/node.tf +++ b/terraform/node.tf @@ -7,9 +7,8 @@ locals { id = 700 + index(keys(var.nodes), k) hash = sha1(v.host) - wan_mac_address = v.mac_address != null ? v.mac_address : "AA:BB:00:00:${format("%v:%v", substr(sha1(v.host), 0, 2), substr(sha1(v.host), 2, 2))}" - private_mac_address = "AA:BB:00:11:${format("%v:%v", substr(sha1(v.host), 0, 2), substr(sha1(v.host), 2, 2))}" - internal_mac_address = "AA:BB:00:22:${format("%v:%v", substr(sha1(v.host), 0, 2), substr(sha1(v.host), 2, 2))}" + wan_mac_address = v.mac_address != null ? v.mac_address : "AA:BB:00:00:${format("%v:%v", substr(sha1(v.host), 0, 2), substr(sha1(v.host), 2, 2))}" + private_mac_address = "AA:BB:00:11:${format("%v:%v", substr(sha1(v.host), 0, 2), substr(sha1(v.host), 2, 2))}" }) } } @@ -26,30 +25,6 @@ resource "proxmox_virtual_environment_network_linux_bridge" "vmbr0" { ports = each.value.bridge_ports } -import { - id = "jakku:vmbr0" - to = proxmox_virtual_environment_network_linux_bridge.vmbr0["jakku"] -} - -import { - id = "batuu:vmbr0" - to = proxmox_virtual_environment_network_linux_bridge.vmbr0["batuu"] -} - -import { - id = "nevaroo:vmbr0" - to = proxmox_virtual_environment_network_linux_bridge.vmbr0["nevaroo"] -} - -moved { - from = proxmox_virtual_environment_network_linux_bridge.vmprivate - to = proxmox_virtual_environment_network_linux_bridge.vmbr1 -} - -moved { - from = proxmox_virtual_environment_network_linux_bridge.vminternal - to = proxmox_virtual_environment_network_linux_bridge.vmbr2 -} resource "proxmox_virtual_environment_network_linux_bridge" "vmbr1" { for_each = local.nodes @@ -59,14 +34,6 @@ resource "proxmox_virtual_environment_network_linux_bridge" "vmbr1" { comment = "Private network for VMs." } -resource "proxmox_virtual_environment_network_linux_bridge" "vmbr2" { - for_each = local.nodes - - node_name = each.value.host - name = "vmbr2" - comment = "Internal network for VMs." -} - resource "proxmox_virtual_environment_file" "iso" { for_each = local.nodes @@ -127,17 +94,14 @@ resource "proxmox_virtual_environment_vm" "nodes" { mac_address = each.value.private_mac_address } - network_device { - bridge = proxmox_virtual_environment_network_linux_bridge.vmbr2[each.key].name - mac_address = each.value.internal_mac_address - } - scsi_hardware = "virtio-scsi-single" - cdrom { - enabled = each.value.iso_enabled - file_id = proxmox_virtual_environment_file.iso[each.key].id - interface = "ide0" + dynamic "cdrom" { + for_each = each.value.iso_enabled ? [1] : [] + content { + file_id = proxmox_virtual_environment_file.iso[each.key].id + interface = "ide0" + } } disk {