adding specifiy geoip option
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 16m53s

This commit is contained in:
2026-04-15 09:29:59 +01:00
parent 9335e0ac24
commit b1def329e9
7 changed files with 95 additions and 23 deletions
+40 -1
View File
@@ -14,7 +14,8 @@ variable "nginx_sites" {
authentication_required = optional(bool, false)
redirect_to_https_bool = optional(bool, true)
listen_port_80_bool = optional(bool, false)
geoip_blocking = optional(bool, true)
geoip_allow = optional(list(string), ["FR", "GB"])
}))
}
@@ -22,6 +23,23 @@ variable "deny_ip" {
type = list(string)
}
locals {
geoip_allow_list = distinct(flatten([
for key, value in var.nginx_sites : [{
name = join("_", sort(value.geoip_allow))
country_list = sort(value.geoip_allow)
}] if value.enabled == true && value.geoip_allow != null
]))
geoip_allow_list_test = distinct([
for key, value in var.nginx_sites : [{
value = sort(value.geoip_allow)
}] if value.enabled == true && value.geoip_allow != null
])
}
resource "kubernetes_config_map" "deny_ip_configmap" {
metadata {
name = "deny-ip-terraform"
@@ -72,11 +90,32 @@ resource "kubernetes_config_map" "automatic-configmap" {
authentication_required = value.authentication_required
redirect_to_https_bool = value.redirect_to_https_bool
listen_port_80_bool = value.listen_port_80_bool
geoip_blocking = value.geoip_blocking
geoip_allow = value.geoip_allow
}) if value.enabled == true
}
}
resource "kubernetes_config_map" "automatic-geoip-allow" {
metadata {
name = "geoip-allow"
namespace = "reverse-proxy"
annotations = {
"reloader.stakater.com/match" : "true",
}
}
data = {
for key, value in local.geoip_allow_list :
"${value.name}.conf" => templatefile("geoip.conf.tftpl", {
name = value.name
allowed_country_list = value.country_list
})
}
}
#resource "null_resource" "cluster" {
# provisioner "local-exec" {