Add restricted web egress rules

This commit is contained in:
2026-11-15 08:46:37 +09:00
parent 7eded181e7
commit 16b5332e96
9 changed files with 116 additions and 1 deletions
+20
View File
@@ -103,6 +103,26 @@ variable "ssh_ingress_rules" {
}))
}
variable "web_egress_policy" {
description = "Restricted outbound ports for the public web instance. Homelab destinations are the two VyOS route CIDRs; public TCP destinations use IPv4 any-address."
type = object({
homelab_tcp_ports = set(number)
homelab_udp_ports = set(number)
public_tcp_ports = set(number)
})
validation {
condition = alltrue([
for port in setunion(
var.web_egress_policy.homelab_tcp_ports,
var.web_egress_policy.homelab_udp_ports,
var.web_egress_policy.public_tcp_ports,
) : port >= 1 && port <= 65535 && port == floor(port)
])
error_message = "Every web egress port must be an integer from 1 through 65535."
}
}
variable "web_instance" {
description = "Existing public web EC2 instance. user_data is intentionally absent."
type = object({