work on a configmap to store these infos for django
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 53s
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 53s
This commit is contained in:
+22
-49
@@ -18,57 +18,35 @@ variable "nginx_sites" {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
resource "local_file" "nginx" {
|
|
||||||
# for_each = var.nginx_sites
|
|
||||||
for_each = { for key, value in var.nginx_sites : key => value if value.enabled == true }
|
|
||||||
content = templatefile("nginx_config.tftpl", {
|
|
||||||
name_site = each.key
|
|
||||||
name_service = each.value.service
|
|
||||||
proxy_cache = each.value.proxy_cache
|
|
||||||
extra-value = each.value.extra-value
|
|
||||||
extra-value-location = each.value.extra-value-location
|
|
||||||
http2_bool = each.value.http2_bool
|
|
||||||
proxy_pass_https = each.value.proxy_pass_https
|
|
||||||
authentication_required = each.value.authentication_required
|
|
||||||
redirect_to_https_bool = each.value.redirect_to_https_bool
|
|
||||||
listen_port_80_bool = each.value.listen_port_80_bool
|
|
||||||
})
|
|
||||||
|
|
||||||
filename = "../conf.d/${each.key}.tryton.geeraert.eu.conf"
|
locals {
|
||||||
|
template = templatefile("websites_terraform.json.tftpl", {
|
||||||
|
map_of_params = var.nginx_sites
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
resource "local_file" "nginx" {
|
||||||
|
content = templatefile("websites_terraform.json.tftpl", {
|
||||||
|
map_of_params = var.nginx_sites })
|
||||||
|
filename = "/tmp/test.tryton.geeraert.eu.conf"
|
||||||
file_permission = "0600"
|
file_permission = "0600"
|
||||||
|
|
||||||
provisioner "local-exec" {
|
}
|
||||||
# command = "kubectl exec -it deploy/reverse-proxy -n reverse-proxy -- nginx -s reload"
|
|
||||||
command = "kubectl get pods -n reverse-proxy -o name | xargs -I{} kubectl exec -n reverse-proxy {} -- nginx -s reload"
|
resource "kubernetes_config_map" "websites_configmap" {
|
||||||
quiet = true
|
metadata {
|
||||||
|
name = "sites-terraform"
|
||||||
|
namespace = "django-python"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"websites.json" = templatefile("websites_terraform.json.tftpl", {
|
||||||
|
map_of_params = var.nginx_sites })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
#resource "kubernetes_config_map" "automatic-configmap" {
|
|
||||||
# metadata {
|
|
||||||
# name = "sites-terraform"
|
|
||||||
# namespace = "reverse-proxy"
|
|
||||||
# }
|
|
||||||
# for_each = { for key, value in var.nginx_sites : key => value if value.enabled == true }
|
|
||||||
# dynamic "data" {
|
|
||||||
# for_each = each.value.enabled == true ? [""] : []
|
|
||||||
# # for_each = { for key, value in var.nginx_sites : key => value if value.enabled == true }
|
|
||||||
# content {
|
|
||||||
# key = (templatefile("nginx_config.tftpl", {
|
|
||||||
# name_site = each.key
|
|
||||||
# name_service = each.value.service
|
|
||||||
# proxy_cache = each.value.proxy_cache
|
|
||||||
# extra-value = each.value.extra-value
|
|
||||||
# http2_bool = each.value.http2_bool
|
|
||||||
# proxy_pass_https = each.value.proxy_pass_https
|
|
||||||
# authentication_required = each.value.authentication_required
|
|
||||||
# }))
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
|
|
||||||
resource "kubernetes_config_map" "automatic-configmap" {
|
resource "kubernetes_config_map" "automatic-configmap" {
|
||||||
metadata {
|
metadata {
|
||||||
@@ -95,11 +73,6 @@ resource "kubernetes_config_map" "automatic-configmap" {
|
|||||||
}) if value.enabled == true
|
}) if value.enabled == true
|
||||||
}
|
}
|
||||||
|
|
||||||
# provisioner "local-exec" {
|
|
||||||
# command = "kubectl get pods -n reverse-proxy -o name | xargs -I{} kubectl delete -n reverse-proxy {}"
|
|
||||||
# quiet = true
|
|
||||||
# }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log my_custom_format;
|
access_log /var/log/nginx/access.log my_custom_format;
|
||||||
|
access_log /var/log/nginx/ip_audit.log ip_audit;
|
||||||
|
|
||||||
${extra-value}
|
${extra-value}
|
||||||
%{~ if http2_bool~}
|
%{~ if http2_bool~}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
%{ for key, value in map_of_params}
|
||||||
|
{
|
||||||
|
"${key}": {
|
||||||
|
"service": "${value.service}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%{ endfor ~}
|
||||||
Reference in New Issue
Block a user