70 lines
2.3 KiB
HCL
70 lines
2.3 KiB
HCL
locals {
|
|
minecraft_port = 25565
|
|
}
|
|
|
|
resource "cloudflare_dns_record" "minecraft" {
|
|
zone_id = one(data.cloudflare_zones.short.result).id
|
|
name = "mc.quorate.dev"
|
|
type = "A"
|
|
content = local.public_ip
|
|
ttl = 120
|
|
proxied = false
|
|
}
|
|
|
|
resource "oci_network_load_balancer_backend_set" "minecraft" {
|
|
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.short.id
|
|
name = "minecraft"
|
|
policy = "FIVE_TUPLE"
|
|
is_preserve_source = false
|
|
health_checker {
|
|
protocol = "TCP"
|
|
port = local.minecraft_port
|
|
interval_in_millis = 10000
|
|
timeout_in_millis = 3000
|
|
retries = 3
|
|
}
|
|
}
|
|
|
|
resource "oci_network_load_balancer_backend" "minecraft" {
|
|
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.short.id
|
|
backend_set_name = oci_network_load_balancer_backend_set.minecraft.name
|
|
ip_address = var.tunnel_address
|
|
port = local.minecraft_port
|
|
name = "minecraft"
|
|
}
|
|
|
|
resource "oci_network_load_balancer_listener" "minecraft" {
|
|
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.short.id
|
|
name = "minecraft"
|
|
default_backend_set_name = oci_network_load_balancer_backend_set.minecraft.name
|
|
port = local.minecraft_port
|
|
protocol = "TCP"
|
|
}
|
|
|
|
resource "oci_core_network_security_group_security_rule" "minecraft_in" {
|
|
network_security_group_id = oci_core_network_security_group.ingress.id
|
|
direction = "INGRESS"
|
|
protocol = "6"
|
|
source = "0.0.0.0/0"
|
|
source_type = "CIDR_BLOCK"
|
|
tcp_options {
|
|
destination_port_range {
|
|
min = local.minecraft_port
|
|
max = local.minecraft_port
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "oci_core_network_security_group_security_rule" "minecraft_out" {
|
|
network_security_group_id = oci_core_network_security_group.ingress.id
|
|
direction = "EGRESS"
|
|
protocol = "6"
|
|
destination = "${var.tunnel_address}/32"
|
|
destination_type = "CIDR_BLOCK"
|
|
tcp_options {
|
|
destination_port_range {
|
|
min = local.minecraft_port
|
|
max = local.minecraft_port
|
|
}
|
|
}
|
|
}
|