Allow disabling SSL too...

This commit is contained in:
Greyscale 2024-06-21 18:01:44 +02:00
parent f5fba1685f
commit b0c7bad36d
No known key found for this signature in database
GPG key ID: 74BAFF55434DA4B2
3 changed files with 8 additions and 1 deletions

View file

@ -10,6 +10,7 @@ locals {
certificate = var.certificate certificate = var.certificate
basic_auth = var.basic_auth basic_auth = var.basic_auth
auth_file = var.basic_auth != null ? "${var.hostname}-auth.conf" : "" auth_file = var.basic_auth != null ? "${var.hostname}-auth.conf" : ""
allow_ssl = var.allow_ssl
allow_non_ssl = var.allow_non_ssl allow_non_ssl = var.allow_non_ssl
redirect_non_ssl = var.redirect_non_ssl redirect_non_ssl = var.redirect_non_ssl
timeout_seconds = var.timeout_seconds timeout_seconds = var.timeout_seconds

View file

@ -25,6 +25,10 @@ variable "basic_auth" {
}) })
default = null default = null
} }
variable "allow_ssl" {
type = bool
default = true
}
variable "allow_non_ssl" { variable "allow_non_ssl" {
type = bool type = bool
default = false default = false

View file

@ -24,12 +24,14 @@ server {
server { server {
%{if allow_non_ssl~} %{if allow_non_ssl~}
# Non-SSL Traffic is allowed # Non-SSL Traffic is allowed
listen ${http_port~} listen ${http_port~};
listen [::]:${http_port}; listen [::]:${http_port};
%{endif~} %{endif~}
%{if allow_ssl~}
# SSL Traffic is allowed # SSL Traffic is allowed
listen ${https_port} ssl; listen ${https_port} ssl;
listen [::]:${https_port} ssl; listen [::]:${https_port} ssl;
%{endif~}
server_name ${hostname}; server_name ${hostname};
access_log /var/log/nginx/${hostname}.access.log; access_log /var/log/nginx/${hostname}.access.log;
error_log /var/log/nginx/${hostname}.error.log; error_log /var/log/nginx/${hostname}.error.log;