89 lines
2.4 KiB
HCL
89 lines
2.4 KiB
HCL
locals {
|
|
dns-name = "${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/assets/okd-logo.svg"
|
|
request_headers = {
|
|
"Content-Type" = "application/json"
|
|
Authorization = "Bearer ${data.kubernetes_secret_v1.authentik.data["AUTHENTIK_BOOTSTRAP_TOKEN"]}"
|
|
}
|
|
service = {
|
|
"name" = "${var.component}-${var.instance}"
|
|
"port" = {
|
|
"number" = 80
|
|
}
|
|
}
|
|
}
|
|
|
|
module "service" {
|
|
source = "/dist/modules/service"
|
|
component = var.component
|
|
instance = var.instance
|
|
namespace = var.namespace
|
|
labels = local.common-labels
|
|
target = "http"
|
|
port = local.service.port.number
|
|
providers = {
|
|
kubectl = kubectl
|
|
}
|
|
}
|
|
|
|
module "ingress" {
|
|
source = "/dist/modules/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 = ["forward-${local.app-name}"]
|
|
service = local.service
|
|
providers = {
|
|
kubectl = kubectl
|
|
}
|
|
}
|
|
|
|
module "application" {
|
|
source = "/dist/modules/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 = "/dist/modules/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 = local.service
|
|
icon = local.icon
|
|
request_headers = local.request_headers
|
|
providers = {
|
|
restapi = restapi
|
|
http = http
|
|
kubectl = kubectl
|
|
authentik = authentik
|
|
}
|
|
}
|