From 5f50071fa272c2d45f26b6936dad4f17ca65a40b Mon Sep 17 00:00:00 2001
From: Matthew Baggett <matthew@baggett.me>
Date: Wed, 29 Jan 2025 18:55:28 +0100
Subject: [PATCH] Formatting

---
 cloud/aws/efs_file_system/security-groups.tf  |  6 +++---
 products/openhaystack/inputs.tf               |  2 +-
 products/quassel/inputs.tf                    | 14 +++++++++++---
 products/quassel/quassel.tf                   |  7 ++++---
 products/traefik/outputs.tf                   |  3 +++
 products/unifi/magic-forward/magic_forward.tf | 10 +++++-----
 utils/identity/locals.tf                      |  4 ++--
 7 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/cloud/aws/efs_file_system/security-groups.tf b/cloud/aws/efs_file_system/security-groups.tf
index 5179ffe..b71ff7b 100644
--- a/cloud/aws/efs_file_system/security-groups.tf
+++ b/cloud/aws/efs_file_system/security-groups.tf
@@ -13,7 +13,7 @@ resource "aws_security_group" "efs" {
   })
 }
 resource "aws_vpc_security_group_ingress_rule" "nfs" {
-  description = "Allow NFS traffic from EFS"
+  description                  = "Allow NFS traffic from EFS"
   ip_protocol                  = "tcp"
   from_port                    = 2049
   to_port                      = 2049
@@ -24,7 +24,7 @@ resource "aws_vpc_security_group_ingress_rule" "nfs" {
   })
 }
 resource "aws_vpc_security_group_egress_rule" "nfs" {
-  description = "Allow NFS traffic to EFS"
+  description                  = "Allow NFS traffic to EFS"
   ip_protocol                  = "tcp"
   from_port                    = 2049
   to_port                      = 2049
@@ -38,7 +38,7 @@ resource "aws_vpc_security_group_egress_rule" "nfs" {
 # checkov:skip=CKV_AWS_25: checkov is mis-detecting this as exposing port 3389 to 0.0.0.0
 # checkov:skip=CKV_AWS_260: checkov is mis-detecting this as exposing port 80 to 0.0.0.0
 resource "aws_vpc_security_group_ingress_rule" "ping" {
-  description = "Allow ping"
+  description                  = "Allow ping"
   ip_protocol                  = "icmp"
   from_port                    = 0
   to_port                      = 0
diff --git a/products/openhaystack/inputs.tf b/products/openhaystack/inputs.tf
index 4691669..fd75fa8 100644
--- a/products/openhaystack/inputs.tf
+++ b/products/openhaystack/inputs.tf
@@ -9,7 +9,7 @@ variable "networks" {
   }))
   default     = []
   description = "A list of network names to attach the service to."
-}/*
+} /*
 variable "ports" {
   type = list(object({
     host      = optional(number)
diff --git a/products/quassel/inputs.tf b/products/quassel/inputs.tf
index 2e17039..56f9bb6 100644
--- a/products/quassel/inputs.tf
+++ b/products/quassel/inputs.tf
@@ -1,7 +1,7 @@
 variable "enable" {
-    type        = bool
-    description = "Whether to enable the service."
-    default     = true
+  type        = bool
+  description = "Whether to enable the service."
+  default     = true
 }
 variable "quassel_image" {
   default     = "lscr.io/linuxserver/quassel-core"
@@ -22,4 +22,12 @@ variable "placement_constraints" {
   default     = []
   type        = list(string)
   description = "Docker Swarm placement constraints"
+}
+variable "ports" {
+  default = [{host=4242, container=4242}]
+  type = list(object({
+    host      = number
+    container = number
+  }))
+  description = "Ports to expose on the service. Default is port 4242."
 }
\ No newline at end of file
diff --git a/products/quassel/quassel.tf b/products/quassel/quassel.tf
index deda3a9..4ba2c77 100644
--- a/products/quassel/quassel.tf
+++ b/products/quassel/quassel.tf
@@ -4,17 +4,18 @@ module "network" {
 }
 module "postgres" {
   source                = "../postgres"
-  enable = var.enable
+  enable                = var.enable
   postgres_version      = "16"
   stack_name            = var.stack_name
   networks              = [module.network]
   username              = "postgres"
   database              = "postgres"
   placement_constraints = var.placement_constraints
+  ports                 = [{ container = 5432 }]
 }
 module "service" {
   source       = "../../docker/service"
-  enable = var.enable
+  enable       = var.enable
   image        = "${var.quassel_image}:${var.quassel_version}"
   stack_name   = var.stack_name
   service_name = "quassel"
@@ -32,6 +33,6 @@ module "service" {
     AUTH_AUTHENTICATOR = "Database"
   }
   placement_constraints = var.placement_constraints
-  ports                 = [{ container = 4242, host = 4242 }]
+  ports                 = var.ports
   converge_enable       = false # @todo MB: add healthcheck and fix this.
 }
diff --git a/products/traefik/outputs.tf b/products/traefik/outputs.tf
index b8a06cd..e6ec39c 100644
--- a/products/traefik/outputs.tf
+++ b/products/traefik/outputs.tf
@@ -6,4 +6,7 @@ output "docker_network" {
 }
 output "endpoint" {
   value = module.traefik.endpoint
+}
+output "hello_endpoint" {
+  value = try(module.traefik_hello[0].endpoint, null)
 }
\ No newline at end of file
diff --git a/products/unifi/magic-forward/magic_forward.tf b/products/unifi/magic-forward/magic_forward.tf
index 3ba4b3a..15d97d9 100644
--- a/products/unifi/magic-forward/magic_forward.tf
+++ b/products/unifi/magic-forward/magic_forward.tf
@@ -1,8 +1,8 @@
 module "port_forward" {
-  source  = "../port-forward"
-  enabled = var.enabled
-  label   = var.label
-  port    = var.port != null ? var.port : var.docker_service.endpoint_spec[0].ports[0].published_port
-  ip      = var.target.fixed_ip
+  source   = "../port-forward"
+  enabled  = var.enabled
+  label    = var.label
+  port     = var.port != null ? var.port : var.docker_service.endpoint_spec[0].ports[0].published_port
+  ip       = var.target.fixed_ip
   protocol = var.protocol
 }
\ No newline at end of file
diff --git a/utils/identity/locals.tf b/utils/identity/locals.tf
index 83f9082..8924959 100644
--- a/utils/identity/locals.tf
+++ b/utils/identity/locals.tf
@@ -1,4 +1,4 @@
 locals {
-  username       = var.username != null ? var.username : random_pet.username[0].id
-  password       = var.password != null ? nonsensitive(var.password) : nonsensitive(random_password.password[0].result)
+  username = var.username != null ? var.username : random_pet.username[0].id
+  password = var.password != null ? nonsensitive(var.password) : nonsensitive(random_password.password[0].result)
 }
\ No newline at end of file