Skip to content

Commit e404dc5

Browse files
committed
fix: tweaks to new switch
1 parent 6612cc3 commit e404dc5

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
locals {
2+
oob_mgmt_cidr = "${var.oob_mgmt_cidr_prefix}/${var.oob_mgmt_cidr_bits}"
3+
}
4+
5+
resource "routeros_ip_address" "oob" {
6+
interface = var.oob_mgmt_port
7+
address = "${cidrhost(local.oob_mgmt_cidr, 1)}/${var.oob_mgmt_cidr_bits}"
8+
}
9+
10+
module "oob_dhcp" {
11+
source = "../ros-dhcp"
12+
13+
interface = var.oob_mgmt_port
14+
cidr_prefix = var.oob_mgmt_cidr_prefix
15+
cidr_bits = var.oob_mgmt_cidr_bits
16+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
locals {
2+
enabled_services = [
3+
"ssh",
4+
"www",
5+
# TODO: setup TLS certs
6+
# "www-ssl",
7+
"winbox"
8+
]
9+
}
10+
11+
data "routeros_ip_services" "self" {}
12+
13+
resource "routeros_ip_service" "self" {
14+
depends_on = [
15+
routeros_ip_address.oob,
16+
routeros_ip_address.mgmt
17+
]
18+
19+
for_each = { for _, v in data.routeros_ip_services.self.services : v.name => v }
20+
numbers = each.key
21+
port = each.value.port
22+
disabled = !contains(local.enabled_services, each.key)
23+
address = contains(local.enabled_services, each.key) ? join(",", [
24+
local.oob_mgmt_cidr,
25+
local.mgmt_cidr,
26+
]) : null
27+
}
28+
29+
resource "routeros_ip_ssh_server" "self" {
30+
always_allow_password_login = false
31+
strong_crypto = true
32+
forwarding_enabled = "remote"
33+
host_key_type = "ed25519"
34+
}

0 commit comments

Comments
 (0)