Fix dashboard UID sanitization for Terraform by replacing regexreplace
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user