Skip to content

Commit

Permalink
Sort core routers to establish stable tunnel interfaces on sites (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino authored Sep 21, 2024
1 parent 4bb44b2 commit 02348bb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,20 @@ locals {
devices = {
for dev in data.netbox_devices.devices.devices : dev.name => dev
}
core_devices = concat(
[for dev in data.netbox_devices.core_routers.devices : {
core_devices_unsorted = merge(
{ for dev in data.netbox_devices.core_routers.devices : dev.name => {
id = dev.device_id
name = dev.name
device = dev
}],
[for vm in data.netbox_virtual_machines.core_routers.vms : {
} },
{ for vm in data.netbox_virtual_machines.core_routers.vms : vm.name => {
id = vm.vm_id
name = vm.name
vm = vm
}],
} },
)
core_device_names_sorted = sort(keys(local.core_devices_unsorted))
core_devices = [for name in local.core_device_names_sorted : local.core_devices_unsorted[name]]
}

data "netbox_ip_addresses" "core_primary" {
Expand Down

0 comments on commit 02348bb

Please sign in to comment.