82 lines
2.4 KiB
HCL
82 lines
2.4 KiB
HCL
locals {
|
|
dns_name = "${var.instance}.${var.sub_domain}.${var.domain_name}"
|
|
dns_names = [local.dns_name]
|
|
app_name = var.component == var.instance ? var.instance : format("%s-%s", var.component, var.instance)
|
|
icon = "_static/src/browser/media/favicon-dark-support.svg"
|
|
request_headers = {
|
|
"Content-Type" = "application/json"
|
|
Authorization = "Bearer ${data.kubernetes_secret_v1.authentik.data["AUTHENTIK_BOOTSTRAP_TOKEN"]}"
|
|
}
|
|
}
|
|
|
|
module "service" {
|
|
source = "git::https://git.solidite.fr/vynil/kydah-modules.git//service"
|
|
component = var.component
|
|
instance = var.instance
|
|
namespace = var.namespace
|
|
labels = local.common_labels
|
|
targets = ["http"]
|
|
providers = {
|
|
kubectl = kubectl
|
|
}
|
|
}
|
|
|
|
module "ingress" {
|
|
source = "git::https://git.solidite.fr/vynil/kydah-modules.git//ingress"
|
|
component = ""
|
|
instance = var.instance
|
|
namespace = var.namespace
|
|
issuer = var.issuer
|
|
ingress_class = var.ingress_class
|
|
labels = local.common_labels
|
|
dns_names = local.dns_names
|
|
middlewares = [module.forward.middleware]
|
|
services = [module.service.default_definition]
|
|
providers = {
|
|
kubectl = kubectl
|
|
}
|
|
}
|
|
|
|
module "application" {
|
|
source = "git::https://git.solidite.fr/vynil/kydah-modules.git//application"
|
|
component = var.component
|
|
instance = var.instance
|
|
app_group = var.app_group
|
|
dns_name = local.dns_name
|
|
icon = local.icon
|
|
protocol_provider = module.forward.provider-id
|
|
providers = {
|
|
authentik = authentik
|
|
}
|
|
}
|
|
|
|
provider "restapi" {
|
|
uri = "http://authentik.${var.domain}-auth.svc/api/v3/"
|
|
headers = local.request_headers
|
|
create_method = "PATCH"
|
|
update_method = "PATCH"
|
|
destroy_method = "PATCH"
|
|
write_returns_object = true
|
|
id_attribute = "name"
|
|
}
|
|
|
|
module "forward" {
|
|
source = "git::https://git.solidite.fr/vynil/kydah-modules.git//forward"
|
|
component = var.component
|
|
instance = var.instance
|
|
domain = var.domain
|
|
namespace = var.namespace
|
|
ingress_class = var.ingress_class
|
|
labels = local.common_labels
|
|
dns_names = local.dns_names
|
|
service = module.service.default_definition
|
|
icon = local.icon
|
|
request_headers = local.request_headers
|
|
providers = {
|
|
restapi = restapi
|
|
http = http
|
|
kubectl = kubectl
|
|
authentik = authentik
|
|
}
|
|
}
|