From 41d0286af9fea3ba4f3ffc6f6b7f7c063c46e599 Mon Sep 17 00:00:00 2001 From: Frederic Leger Date: Fri, 6 Dec 2024 21:56:34 +0100 Subject: [PATCH] fix(k8s): labels must comply with DNS RFC1123 --- k8s/k8s-secret/main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/k8s/k8s-secret/main.tf b/k8s/k8s-secret/main.tf index 869f255..7de27cf 100644 --- a/k8s/k8s-secret/main.tf +++ b/k8s/k8s-secret/main.tf @@ -1,11 +1,11 @@ locals { interpolated_tags = merge({ # NOTE: label names must comply with DNS rfc1123 - "name" = var.name, - "customer" = var.customer, - "environment" = var.environment, - "managed-by" = "Terraform", - "last-modified-at" = time_static.last_update.rfc3339, + "name" = lower(replace(var.name, "/[^a-zA-Z0-9-]/", "-")), + "customer" = lower(replace(var.customer, "/[^a-zA-Z0-9-]/", "-")), + "environment" = lower(replace(var.environment, "/[^a-zA-Z0-9-]/", "-")), + "managed-by" = "terraform", + "last-modified-at" = lower(replace(time_static.last_update.rfc3339, "/[^a-zA-Z0-9-]/", "-")), }, var.tags )