Skip to content

Commit 9d463de

Browse files
committed
fix: comply with DNS RFC for all k8s objects
1 parent c26e12b commit 9d463de

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

k8s/k8s-namespace/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
locals {
22
interpolated_tags = merge({
3-
"Name" = var.name,
4-
"Customer" = var.customer,
5-
"Environment" = var.environment,
6-
"ManagedBy" = "Terraform",
7-
"LastModifiedAt" = time_static.last_update.rfc3339,
3+
# NOTE: label names must comply with DNS rfc1123
4+
"name" = lower(replace(var.name, "/[^a-zA-Z0-9-]/", "-")),
5+
"customer" = lower(replace(var.customer, "/[^a-zA-Z0-9-]/", "-")),
6+
"environment" = lower(replace(var.environment, "/[^a-zA-Z0-9-]/", "-")),
7+
"managed-by" = "terraform",
8+
"last-modified-at" = formatdate("YYYYMMDD-hhmmss", time_static.last_update.rfc3339),
89
},
910
var.tags
1011
)

k8s/k8s-secret/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ locals {
55
"customer" = lower(replace(var.customer, "/[^a-zA-Z0-9-]/", "-")),
66
"environment" = lower(replace(var.environment, "/[^a-zA-Z0-9-]/", "-")),
77
"managed-by" = "terraform",
8-
"last-modified-at" = lower(replace(time_static.last_update.rfc3339, "/[^a-zA-Z0-9-]/", "-")),
8+
"last-modified-at" = formatdate("YYYYMMDD-hhmmss", time_static.last_update.rfc3339),
99
},
1010
var.tags
1111
)

0 commit comments

Comments
 (0)