Use my standardised settings
This commit is contained in:
parent
4dcee59e1a
commit
a046e9c47c
84 changed files with 137 additions and 22 deletions
docker
network
service
socket-proxy
products
apt-caching-proxy
archiveteam/warrior
forgejo/actions-runner
gitea/actions-runner
github/actions-runner
nginx
pgbackweb
portainer
postgres
quassel
redis
statping
threeproxy
unifi
watchtower
|
@ -1,10 +1,10 @@
|
||||||
module "network" {
|
module "network" {
|
||||||
source = "../docker-network"
|
source = "../network"
|
||||||
name = "docker-socket-proxy"
|
name = "docker-socket-proxy"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
}
|
}
|
||||||
module "service" {
|
module "service" {
|
||||||
source = "../docker-service"
|
source = "../service"
|
||||||
image = "${var.docker_socket_proxy_image}:${var.docker_socket_proxy_version}"
|
image = "${var.docker_socket_proxy_image}:${var.docker_socket_proxy_version}"
|
||||||
command = ["/docker-entrypoint.sh", "sockd-username"]
|
command = ["/docker-entrypoint.sh", "sockd-username"]
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
|
@ -1,5 +1,5 @@
|
||||||
module "ap" {
|
module "ap" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "sameersbn/apt-cacher-ng"
|
image = "sameersbn/apt-cacher-ng"
|
||||||
stack_name = "apt-caching-proxy"
|
stack_name = "apt-caching-proxy"
|
||||||
service_name = "apt-caching-proxy"
|
service_name = "apt-caching-proxy"
|
|
@ -1,5 +1,5 @@
|
||||||
module "warrior" {
|
module "warrior" {
|
||||||
source = "../docker-service"
|
source = "../../../docker/service"
|
||||||
image = "atdr.meo.ws/archiveteam/warrior-dockerfile"
|
image = "atdr.meo.ws/archiveteam/warrior-dockerfile"
|
||||||
stack_name = "archiveteam"
|
stack_name = "archiveteam"
|
||||||
service_name = var.service_name
|
service_name = var.service_name
|
|
@ -1,5 +1,5 @@
|
||||||
module "forgejo_actions_runner" {
|
module "forgejo_actions_runner" {
|
||||||
source = "../docker-service"
|
source = "../../../docker/service"
|
||||||
service_name = var.service_name
|
service_name = var.service_name
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
placement_constraints = var.placement_constraints
|
placement_constraints = var.placement_constraints
|
|
@ -1,5 +1,5 @@
|
||||||
module "gitea_actions_runner" {
|
module "gitea_actions_runner" {
|
||||||
source = "../docker-service"
|
source = "./../../../docker/service"
|
||||||
service_name = var.service_name
|
service_name = var.service_name
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
placement_constraints = var.placement_constraints
|
placement_constraints = var.placement_constraints
|
|
@ -1,5 +1,5 @@
|
||||||
module "github_actions_runner" {
|
module "github_actions_runner" {
|
||||||
source = "../docker-service"
|
source = "../../../docker/service"
|
||||||
service_name = var.service_name
|
service_name = var.service_name
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
placement_constraints = var.placement_constraints
|
placement_constraints = var.placement_constraints
|
0
nginx/.gitignore → products/nginx/.gitignore
vendored
0
nginx/.gitignore → products/nginx/.gitignore
vendored
|
@ -13,7 +13,7 @@ variable "acme_certificate" {
|
||||||
|
|
||||||
module "nginx_config" {
|
module "nginx_config" {
|
||||||
count = var.nginx_hostname != null ? 1 : 0
|
count = var.nginx_hostname != null ? 1 : 0
|
||||||
source = "../nginx/nginx-site-available"
|
source = "../nginx/site-available"
|
||||||
service_name = module.pgbackweb.service_name
|
service_name = module.pgbackweb.service_name
|
||||||
hostname = var.nginx_hostname
|
hostname = var.nginx_hostname
|
||||||
upstream_host = "${module.pgbackweb.service_name}:8085"
|
upstream_host = "${module.pgbackweb.service_name}:8085"
|
|
@ -1,5 +1,5 @@
|
||||||
module "network" {
|
module "network" {
|
||||||
source = "../docker-network"
|
source = "../../docker/network"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
}
|
}
|
||||||
resource "random_password" "encryption_key" {
|
resource "random_password" "encryption_key" {
|
||||||
|
@ -7,7 +7,7 @@ resource "random_password" "encryption_key" {
|
||||||
special = false
|
special = false
|
||||||
}
|
}
|
||||||
module "pgbackweb" {
|
module "pgbackweb" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "${var.pgbackweb_image}:${var.pgbackweb_version}"
|
image = "${var.pgbackweb_image}:${var.pgbackweb_version}"
|
||||||
environment_variables = {
|
environment_variables = {
|
||||||
PBW_ENCRYPTION_KEY = nonsensitive(random_password.encryption_key.result)
|
PBW_ENCRYPTION_KEY = nonsensitive(random_password.encryption_key.result)
|
||||||
|
@ -19,7 +19,7 @@ module "pgbackweb" {
|
||||||
placement_constraints = var.placement_constraints
|
placement_constraints = var.placement_constraints
|
||||||
}
|
}
|
||||||
module "postgres" {
|
module "postgres" {
|
||||||
source = "../docker-postgres"
|
source = "../postgres"
|
||||||
postgres_version = "16"
|
postgres_version = "16"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
networks = [module.network.network]
|
networks = [module.network.network]
|
|
@ -1,5 +1,5 @@
|
||||||
module "service" {
|
module "service" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "${var.postgres_image}:${var.postgres_version}"
|
image = "${var.postgres_image}:${var.postgres_version}"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
service_name = "postgres"
|
service_name = "postgres"
|
|
@ -1,9 +1,9 @@
|
||||||
module "network" {
|
module "network" {
|
||||||
source = "../docker-network"
|
source = "../../docker/network"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
}
|
}
|
||||||
module "postgres" {
|
module "postgres" {
|
||||||
source = "../docker-postgres"
|
source = "../postgres"
|
||||||
postgres_version = "16"
|
postgres_version = "16"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
networks = [module.network.network]
|
networks = [module.network.network]
|
||||||
|
@ -13,7 +13,7 @@ module "postgres" {
|
||||||
ports = [{ container = 5432, host = 65432 }]
|
ports = [{ container = 5432, host = 65432 }]
|
||||||
}
|
}
|
||||||
module "service" {
|
module "service" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "${var.quassel_image}:${var.quassel_version}"
|
image = "${var.quassel_image}:${var.quassel_version}"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
service_name = "quassel"
|
service_name = "quassel"
|
|
@ -1,5 +1,5 @@
|
||||||
module "service" {
|
module "service" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "${var.redis_image}:${var.redis_version}"
|
image = "${var.redis_image}:${var.redis_version}"
|
||||||
command = ["redis-server", "--requirepass", local.auth, "--appendonly", "yes", "--save", 60, 1, "--loglevel", "warning"]
|
command = ["redis-server", "--requirepass", local.auth, "--appendonly", "yes", "--save", 60, 1, "--loglevel", "warning"]
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
|
@ -12,7 +12,7 @@ variable "acme_certificate" {
|
||||||
}
|
}
|
||||||
module "nginx_config" {
|
module "nginx_config" {
|
||||||
count = var.nginx_hostname != null ? 1 : 0
|
count = var.nginx_hostname != null ? 1 : 0
|
||||||
source = "../nginx/nginx-site-available"
|
source = "../nginx/site-available"
|
||||||
service_name = module.service.service_name
|
service_name = module.service.service_name
|
||||||
hostname = var.nginx_hostname
|
hostname = var.nginx_hostname
|
||||||
upstream_host = "${module.service.service_name}:8080"
|
upstream_host = "${module.service.service_name}:8080"
|
|
@ -1,9 +1,9 @@
|
||||||
module "network" {
|
module "network" {
|
||||||
source = "../docker-network"
|
source = "../../docker/network"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
}
|
}
|
||||||
module "postgres" {
|
module "postgres" {
|
||||||
source = "../docker-postgres"
|
source = "../../products/postgres"
|
||||||
postgres_version = "16"
|
postgres_version = "16"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
networks = [module.network.network]
|
networks = [module.network.network]
|
||||||
|
@ -11,7 +11,7 @@ module "postgres" {
|
||||||
ports = [{ container = 5432, host = 65200 }]
|
ports = [{ container = 5432, host = 65200 }]
|
||||||
}
|
}
|
||||||
module "service" {
|
module "service" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "${var.statping_image}:${var.statping_version}"
|
image = "${var.statping_image}:${var.statping_version}"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
service_name = "statping"
|
service_name = "statping"
|
|
@ -12,7 +12,7 @@ locals {
|
||||||
http_endpoint = "http://${local.username}:${local.password}@${var.endpoint}:${var.http_proxy_port}"
|
http_endpoint = "http://${local.username}:${local.password}@${var.endpoint}:${var.http_proxy_port}"
|
||||||
}
|
}
|
||||||
module "service" {
|
module "service" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "${var.threeproxy_image}:${var.threeproxy_version}"
|
image = "${var.threeproxy_image}:${var.threeproxy_version}"
|
||||||
stack_name = var.stack_name
|
stack_name = var.stack_name
|
||||||
service_name = var.service_name
|
service_name = var.service_name
|
45
products/unifi/magic-forward/input.tf
Normal file
45
products/unifi/magic-forward/input.tf
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
variable "enabled" {
|
||||||
|
default = true
|
||||||
|
description = "Whether the port forward should be enabled"
|
||||||
|
type = bool
|
||||||
|
}
|
||||||
|
variable "label" {
|
||||||
|
description = "The label of the port forward"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
variable "docker_service" {
|
||||||
|
description = "The Docker Service to forward to"
|
||||||
|
type = object({
|
||||||
|
name = string
|
||||||
|
endpoint_spec = list(object({
|
||||||
|
protocol = optional(string)
|
||||||
|
target_port = optional(number)
|
||||||
|
published_port = number
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
variable "target" {
|
||||||
|
description = "The Target Host to forward traffic to"
|
||||||
|
type = object({
|
||||||
|
mac = string
|
||||||
|
name = string
|
||||||
|
fixed_ip = string
|
||||||
|
local_dns_record = optional(string)
|
||||||
|
dev_id_override = optional(string)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
variable "protocol" {
|
||||||
|
default = "tcp"
|
||||||
|
description = "The protocol to use for the port forward"
|
||||||
|
type = string
|
||||||
|
validation {
|
||||||
|
condition = var.protocol == "tcp" || var.protocol == "udp" || var.protocol == "any"
|
||||||
|
error_message = "Protocol must be either tcp or udp or any!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "port" {
|
||||||
|
description = "Override the detected port to forward"
|
||||||
|
type = number
|
||||||
|
default = null
|
||||||
|
}
|
7
products/unifi/magic-forward/magic_forward.tf
Normal file
7
products/unifi/magic-forward/magic_forward.tf
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module "port_forward" {
|
||||||
|
source = "../port-forward"
|
||||||
|
enabled = var.enabled
|
||||||
|
label = var.label
|
||||||
|
port_to = var.port != null ? var.port : var.docker_service.endpoint_spec[0].ports[0].published_port
|
||||||
|
ip = var.target.fixed_ip
|
||||||
|
}
|
3
products/unifi/magic-forward/terraform.tf
Normal file
3
products/unifi/magic-forward/terraform.tf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
terraform {
|
||||||
|
required_version = "~> 1.6"
|
||||||
|
}
|
43
products/unifi/port-forward/input.tf
Normal file
43
products/unifi/port-forward/input.tf
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
variable "enabled" {
|
||||||
|
default = true
|
||||||
|
description = "Whether the port forward should be enabled"
|
||||||
|
type = bool
|
||||||
|
}
|
||||||
|
variable "label" {
|
||||||
|
description = "The label of the port forward"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
variable "ip" {
|
||||||
|
description = "The target IP address to forward to"
|
||||||
|
type = string
|
||||||
|
validation {
|
||||||
|
condition = can(cidrnetmask(var.ip))
|
||||||
|
error_message = "Must be a valid IPv4 CIDR block address."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
variable "port" {
|
||||||
|
description = "The port to forward"
|
||||||
|
type = number
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
variable "port_from" {
|
||||||
|
description = "The port to forward from"
|
||||||
|
type = number
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
variable "port_to" {
|
||||||
|
description = "The port to forward to"
|
||||||
|
type = number
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "protocol" {
|
||||||
|
default = "tcp"
|
||||||
|
description = "The protocol to use for the port forward"
|
||||||
|
type = string
|
||||||
|
validation {
|
||||||
|
condition = var.protocol == "tcp" || var.protocol == "udp" || var.protocol == "any"
|
||||||
|
error_message = "Protocol must be either tcp or udp or any!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
8
products/unifi/port-forward/port_forward.tf
Normal file
8
products/unifi/port-forward/port_forward.tf
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
resource "unifi_port_forward" "port_forward" {
|
||||||
|
count = var.enabled ? 1 : 0
|
||||||
|
name = var.label
|
||||||
|
dst_port = var.port_to != null ? var.port_to : var.port
|
||||||
|
fwd_port = var.port_from != null ? var.port_from : var.port
|
||||||
|
protocol = var.protocol
|
||||||
|
fwd_ip = var.ip
|
||||||
|
}
|
9
products/unifi/port-forward/terraform.tf
Normal file
9
products/unifi/port-forward/terraform.tf
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
terraform {
|
||||||
|
required_version = "~> 1.6"
|
||||||
|
required_providers {
|
||||||
|
unifi = {
|
||||||
|
source = "paultyng/unifi"
|
||||||
|
version = "0.41.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
module "watchtower" {
|
module "watchtower" {
|
||||||
source = "../docker-service"
|
source = "../../docker/service"
|
||||||
image = "containrrr/watchtower:latest"
|
image = "containrrr/watchtower:latest"
|
||||||
stack_name = "watchtower"
|
stack_name = "watchtower"
|
||||||
service_name = "watchtower"
|
service_name = "watchtower"
|
Loading…
Reference in a new issue