Fix dashboard UID sanitization for Terraform by replacing regexreplace
All checks were successful
terraform-dev / validate (push) Successful in 5s
terraform-dev / plan (push) Successful in 5s
terraform-dev / apply (push) Has been skipped

This commit is contained in:
Alexandr
2026-03-25 08:54:43 +03:00
parent 41fc5b3015
commit 7b83b84460

View File

@ -7,11 +7,11 @@ locals {
file_path = "${group.dashboard_path_if_exist}/${file}"
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
dashboard_uid = substr(
regexreplace(
replace(
lower(
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
),
"[^a-z0-9_-]",
"/[^a-z0-9_-]/",
"_"
),
0,
@ -32,11 +32,11 @@ locals {
file_path = "${group.dashboard_path_if_exist}/${file}"
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
dashboard_uid = substr(
regexreplace(
replace(
lower(
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
),
"[^a-z0-9_-]",
"/[^a-z0-9_-]/",
"_"
),
0,
@ -57,11 +57,11 @@ locals {
file_path = "${group.dashboard_path_if_exist}/${file}"
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
dashboard_uid = substr(
regexreplace(
replace(
lower(
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
),
"[^a-z0-9_-]",
"/[^a-z0-9_-]/",
"_"
),
0,
@ -82,11 +82,11 @@ locals {
file_path = "${group.dashboard_path_if_exist}/${file}"
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
dashboard_uid = substr(
regexreplace(
replace(
lower(
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
),
"[^a-z0-9_-]",
"/[^a-z0-9_-]/",
"_"
),
0,