From ebb04e4d1844ef30fcde4019a000c58ebbd58836 Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Wed, 28 Jan 2026 15:50:42 -0500 Subject: [PATCH 1/4] chore(server): add traefik-route to charm tf outputs --- server/terraform/charm/outputs.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/terraform/charm/outputs.tf b/server/terraform/charm/outputs.tf index feb84a1ab..c1987ec1b 100644 --- a/server/terraform/charm/outputs.tf +++ b/server/terraform/charm/outputs.tf @@ -6,6 +6,7 @@ output "app_name" { output "endpoints" { description = "Map of all endpoints" value = { - nginx_route = "nginx-route" + nginx_route = "nginx-route" + traefik_route = "traefik-route" } } From 8abc1933d7da9f1c52719d9ecc913ad95a1e6911 Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Wed, 28 Jan 2026 16:06:54 -0500 Subject: [PATCH 2/4] chore(server): replace nginx with traefik in product tf module - remove units input for traefik_k8s (doesn't make sense to deploy multiple units) - simplify product outputs --- server/terraform/product/README.md | 25 +++++++++-------------- server/terraform/product/main.tf | 24 +++++++++++----------- server/terraform/product/outputs.tf | 29 +++------------------------ server/terraform/product/variables.tf | 3 +-- 4 files changed, 26 insertions(+), 55 deletions(-) diff --git a/server/terraform/product/README.md b/server/terraform/product/README.md index 0733094d9..b8a8dcf71 100644 --- a/server/terraform/product/README.md +++ b/server/terraform/product/README.md @@ -39,27 +39,22 @@ deployment onto any Kubernetes environment managed by [Juju]. | Name | Type | | ------------------------------------------------------------- | ----------- | | [juju_model.hardware_api][juju_model] | data source | -| [juju_application.nginx_ingress_integrator][juju_application] | resource | -| [juju_integration.hardware_api_ingress][juju_integration] | resource | +| [juju_application.traefik_k8s][juju_application] | resource | +| [juju_integration.traefik_k8s-hardware_api][juju_integration] | resource | ## Inputs -| Name | Description | Type | -| ------------------------ | --------------------------------------------------------------------------------- | ------ | -| model | Reference to an existing model resource or data source for the model to deploy to | string | -| hardware_api | n/a | object | -| nginx_ingress_integrator | n/a | object | +| Name | Description | Type | +| ------------ | --------------------------------------------------------------------------------- | ------ | +| model | Reference to an existing model resource or data source for the model to deploy to | string | +| hardware_api | n/a | object | +| traefik_k8s | n/a | object | ## Outputs -| Name | Description | -| --------------------------------- | --------------------------------------------------------- | -| hardware_api_app_name | Name of the deployed Hardware API application | -| hardware_api_requires | | -| hardware_api_provides | | -| nginx_ingress_integrator_app_name | Name of the deployed NGINX Ingress Integrator application | -| nginx_ingress_integrator_requires | | -| nginx_ingress_integrator_provides | | +| Name | Description | +| ------------ | -------------------------------------- | +| applications | The applications making up the product | [terraform]: https://terraform.io [hardware-api-charm]: https://charmhub.io/hardware-api diff --git a/server/terraform/product/main.tf b/server/terraform/product/main.tf index fde01cdf1..e63a4a918 100644 --- a/server/terraform/product/main.tf +++ b/server/terraform/product/main.tf @@ -14,27 +14,27 @@ module "hardware_api" { units = var.hardware_api.units } -resource "juju_application" "nginx_ingress_integrator" { - name = var.nginx_ingress_integrator.app_name +resource "juju_application" "traefik_k8s" { + name = var.traefik_k8s.app_name model = data.juju_model.hardware_api.name trust = true charm { - name = "nginx-ingress-integrator" - channel = var.nginx_ingress_integrator.channel - revision = var.nginx_ingress_integrator.revision + name = "traefik-k8s" + channel = var.traefik_k8s.channel + revision = var.traefik_k8s.revision } - units = var.nginx_ingress_integrator.units - config = var.nginx_ingress_integrator.config + units = 1 + config = var.traefik_k8s.config } -resource "juju_integration" "hardware_api_ingress" { +resource "juju_integration" "traefik_k8s-hardware_api" { model = data.juju_model.hardware_api.name application { - name = module.hardware_api.app_name - endpoint = module.hardware_api.endpoints.nginx_route + name = juju_application.traefik_k8s.name + endpoint = "traefik-route" } application { - name = juju_application.nginx_ingress_integrator.name - endpoint = "nginx-route" + name = module.hardware_api.app_name + endpoint = module.hardware_api.endpoints.traefik_route } } diff --git a/server/terraform/product/outputs.tf b/server/terraform/product/outputs.tf index e0cafd81f..af60a6499 100644 --- a/server/terraform/product/outputs.tf +++ b/server/terraform/product/outputs.tf @@ -1,29 +1,6 @@ -output "hardware_api_app_name" { - description = "The name of the Hardware API application" - value = module.hardware_api.app_name -} - -output "hardware_api_requires" { - value = { - nginx_route = "nginx-route" - } -} - -output "hardware_api_provides" { - value = {} -} - -output "nginx_ingress_integrator_app_name" { - description = "The name of the NGINX Ingress Integrator application" - value = juju_application.nginx_ingress_integrator.name -} - -output "nginx_ingress_integrator_requires" { - value = {} -} - -output "nginx_ingress_integrator_provides" { +output "applications" { value = { - nginx_route = "nginx-route" + hardware_api = module.hardware_api + traefik_k8s = juju_application.traefik_k8s } } diff --git a/server/terraform/product/variables.tf b/server/terraform/product/variables.tf index ced691d7e..922a87636 100644 --- a/server/terraform/product/variables.tf +++ b/server/terraform/product/variables.tf @@ -17,12 +17,11 @@ variable "hardware_api" { }) } -variable "nginx_ingress_integrator" { +variable "traefik_k8s" { type = object({ app_name = optional(string, "ingress") channel = optional(string, "latest/stable") config = optional(map(string), {}) revision = optional(number) - units = optional(number, 1) }) } From 59df2da553d25a223df0dcd520042eae6fc78d2c Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Wed, 28 Jan 2026 16:12:44 -0500 Subject: [PATCH 3/4] chore(server): rename default terraform app name "hwapi" --- server/terraform/charm/variables.tf | 2 +- server/terraform/product/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/terraform/charm/variables.tf b/server/terraform/charm/variables.tf index 40fc5f4d6..262adec66 100644 --- a/server/terraform/charm/variables.tf +++ b/server/terraform/charm/variables.tf @@ -1,6 +1,6 @@ variable "app_name" { type = string - default = "api" + default = "hwapi" description = "Name to give the deployed application" } diff --git a/server/terraform/product/variables.tf b/server/terraform/product/variables.tf index 922a87636..a08a82c58 100644 --- a/server/terraform/product/variables.tf +++ b/server/terraform/product/variables.tf @@ -7,7 +7,7 @@ variable "model" { variable "hardware_api" { type = object({ - app_name = optional(string, "api") + app_name = optional(string, "hwapi") channel = optional(string, "latest/edge") config = optional(map(string), {}) constraints = optional(string, "arch=amd64") From da25fecba977097cbc46e248648bf1e22c85bcc6 Mon Sep 17 00:00:00 2001 From: Pedro Avalos Jimenez Date: Wed, 28 Jan 2026 16:14:36 -0500 Subject: [PATCH 4/4] chore(server): add lego to product terraform module this provides the tls certificates for the ingress --- server/terraform/product/README.md | 3 +++ server/terraform/product/main.tf | 24 ++++++++++++++++++++++++ server/terraform/product/outputs.tf | 1 + server/terraform/product/variables.tf | 9 +++++++++ 4 files changed, 37 insertions(+) diff --git a/server/terraform/product/README.md b/server/terraform/product/README.md index b8a8dcf71..70b8a4f5b 100644 --- a/server/terraform/product/README.md +++ b/server/terraform/product/README.md @@ -41,6 +41,8 @@ deployment onto any Kubernetes environment managed by [Juju]. | [juju_model.hardware_api][juju_model] | data source | | [juju_application.traefik_k8s][juju_application] | resource | | [juju_integration.traefik_k8s-hardware_api][juju_integration] | resource | +| [juju_application.lego][juju_application] | resource | +| [juju_integration.lego-traefik_k8s][juju_integration] | resource | ## Inputs @@ -49,6 +51,7 @@ deployment onto any Kubernetes environment managed by [Juju]. | model | Reference to an existing model resource or data source for the model to deploy to | string | | hardware_api | n/a | object | | traefik_k8s | n/a | object | +| lego | n/a | object | ## Outputs diff --git a/server/terraform/product/main.tf b/server/terraform/product/main.tf index e63a4a918..1dba58c8f 100644 --- a/server/terraform/product/main.tf +++ b/server/terraform/product/main.tf @@ -38,3 +38,27 @@ resource "juju_integration" "traefik_k8s-hardware_api" { endpoint = module.hardware_api.endpoints.traefik_route } } + +resource "juju_application" "lego" { + name = var.lego.app_name + model = data.juju_model.hardware_api.name + charm { + name = "lego" + channel = var.lego.channel + revision = var.lego.revision + } + units = 1 + config = var.lego.config +} + +resource "juju_integration" "lego-traefik_k8s" { + model = data.juju_model.hardware_api.name + application { + name = juju_application.lego.name + endpoint = "certificates" + } + application { + name = juju_application.traefik_k8s.name + endpoint = "certificates" + } +} diff --git a/server/terraform/product/outputs.tf b/server/terraform/product/outputs.tf index af60a6499..e3c22690b 100644 --- a/server/terraform/product/outputs.tf +++ b/server/terraform/product/outputs.tf @@ -2,5 +2,6 @@ output "applications" { value = { hardware_api = module.hardware_api traefik_k8s = juju_application.traefik_k8s + lego = juju_application.lego } } diff --git a/server/terraform/product/variables.tf b/server/terraform/product/variables.tf index a08a82c58..330005450 100644 --- a/server/terraform/product/variables.tf +++ b/server/terraform/product/variables.tf @@ -25,3 +25,12 @@ variable "traefik_k8s" { revision = optional(number) }) } + +variable "lego" { + type = object({ + app_name = optional(string, "certificates") + channel = optional(string, "latest/stable") + config = optional(map(string), {}) + revision = optional(number) + }) +}