variable "kube_config_path" { type = string default = "~/.kube/config" } variable "kube_config_context" { type = string default = "colima" } provider "kubernetes" { config_path = var.kube_config_path config_context = var.kube_config_context } provider "helm" { kubernetes { config_path = var.kube_config_path config_context = var.kube_config_context } } resource "helm_release" "traefik" { name = "traefik" repository = "https://helm.traefik.io/traefik" chart = "traefik" set { name = "ingressClass.enabled" value = true } set { name = "ingressClass.isDefaultClass" value = true } } resource "kubernetes_manifest" "traefik_dashboard" { manifest = { apiVersion = "traefik.containo.us/v1alpha1" kind = "IngressRoute" metadata = { name = "public-traefik-dashboard" namespace = "default" } spec = { entryPoints = [ "web" ] routes = [ { match = "PathPrefix(`/dashboard`) || PathPrefix(`/api`)" kind = "Rule" services = [ { name = "api@internal" kind = "TraefikService" }, ] }, ] } } } module "whoami" { source = "./simple_service" name = "whoami" image = "containous/whoami:latest" expose_ports = [80] } module "whoami-ingress" { source = "./traefik_ingress" app_name = "whoami" match_route = "PathPrefix(`/whoami`)" } module "whoami2" { source = "./simple_service" name = "whoami2" image = "containous/whoami:latest" expose_ports = [80] } module "whoami2-ingress" { source = "./traefik_ingress" app_name = "whoami2" match_route = "PathPrefix(`/whoami2`)" } resource "helm_release" "prom_stack" { name = "kube-prom-stack" repository = "https://prometheus-community.github.io/helm-charts" chart = "kube-prometheus-stack" set { name = "alert_manager.enabled" value = false } }