This commit is contained in:
Mike McFetridge
2026-07-20 09:23:17 -04:00
parent c1315882da
commit 72272e4006
3179 changed files with 562960 additions and 14 deletions
@@ -0,0 +1,36 @@
data "netbird_network" "router_network" {
name = "<< network_name >>"
}
<%- if router_target_mode == "peer" %>
data "netbird_peer" "router_peer" {
name = "<< peer_name >>"
}
<%- endif %>
<%- if router_target_mode == "peer_groups" %>
locals {
router_peer_group_names = [
for name in split(",", "<< peer_group_names >>") : trimspace(name)
if trimspace(name) != ""
]
}
data "netbird_group" "router_peer_groups" {
for_each = toset(local.router_peer_group_names)
name = each.value
}
<%- endif %>
resource "netbird_network_router" "network_router" {
network_id = data.netbird_network.router_network.id
enabled = << router_enabled | lower >>
masquerade = << router_masquerade | lower >>
metric = << router_metric >>
<%- if router_target_mode == "peer" %>
peer = data.netbird_peer.router_peer.id
<%- endif %>
<%- if router_target_mode == "peer_groups" %>
peer_groups = [for name in local.router_peer_group_names : data.netbird_group.router_peer_groups[name].id]
<%- endif %>
}
@@ -0,0 +1,112 @@
{
"slug": "netbird-network-router",
"kind": "terraform",
"metadata": {
"name": "NetBird Network Router",
"description": "Creates a NetBird network router and targets either a single peer or a peer group.",
"tags": [
"netbird",
"terraform"
],
"icon": {
"provider": "selfhst",
"id": "netbird"
},
"draft": false,
"version": {
"name": "0.0.12",
"source_dep_name": "manual/netbird-network-router"
}
},
"variables": [
{
"title": "General",
"name": "general",
"items": [
{
"name": "router_enabled",
"type": "bool",
"title": "Enabled",
"required": false,
"default": true
},
{
"name": "router_masquerade",
"type": "bool",
"title": "Masquerade",
"required": false,
"default": true,
"description": "Masquerade routed traffic on the selected router peer."
},
{
"name": "router_metric",
"type": "int",
"title": "Metric",
"required": false,
"default": 9999,
"description": "Router metric. Lower values have higher priority.",
"config": {
"placeholder": "9999"
}
},
{
"name": "router_target_mode",
"type": "enum",
"title": "Target Mode",
"required": true,
"default": "peer_groups",
"description": "Route through a single peer or a peer group.",
"config": {
"options": [
"peer_groups",
"peer"
]
}
}
]
},
{
"title": "Lookups",
"name": "lookups",
"items": [
{
"name": "network_name",
"type": "str",
"title": "Network Name",
"required": true,
"description": "Existing NetBird network name for the parent network lookup.",
"config": {
"placeholder": "production-network"
}
},
{
"name": "peer_name",
"type": "str",
"title": "Peer Name",
"required": true,
"description": "Existing NetBird peer name for the router peer lookup.",
"needs": [
"router_target_mode=peer"
],
"config": {
"placeholder": "gateway-peer"
}
},
{
"name": "peer_group_names",
"type": "str",
"title": "Peer Group Names",
"required": true,
"description": "Comma-separated existing NetBird group names for router groups.",
"needs": [
"router_target_mode=peer_groups"
],
"config": {
"placeholder": "Routers,Gateways",
"textarea": true
}
}
]
}
]
}