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}"
|
file_path = "${group.dashboard_path_if_exist}/${file}"
|
||||||
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
||||||
dashboard_uid = substr(
|
dashboard_uid = substr(
|
||||||
regexreplace(
|
replace(
|
||||||
lower(
|
lower(
|
||||||
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
|
"${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,
|
0,
|
||||||
@ -32,11 +32,11 @@ locals {
|
|||||||
file_path = "${group.dashboard_path_if_exist}/${file}"
|
file_path = "${group.dashboard_path_if_exist}/${file}"
|
||||||
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
||||||
dashboard_uid = substr(
|
dashboard_uid = substr(
|
||||||
regexreplace(
|
replace(
|
||||||
lower(
|
lower(
|
||||||
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
|
"${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,
|
0,
|
||||||
@ -57,11 +57,11 @@ locals {
|
|||||||
file_path = "${group.dashboard_path_if_exist}/${file}"
|
file_path = "${group.dashboard_path_if_exist}/${file}"
|
||||||
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
||||||
dashboard_uid = substr(
|
dashboard_uid = substr(
|
||||||
regexreplace(
|
replace(
|
||||||
lower(
|
lower(
|
||||||
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
|
"${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,
|
0,
|
||||||
@ -82,11 +82,11 @@ locals {
|
|||||||
file_path = "${group.dashboard_path_if_exist}/${file}"
|
file_path = "${group.dashboard_path_if_exist}/${file}"
|
||||||
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
dashboard_json = jsondecode(file("${group.dashboard_path_if_exist}/${file}"))
|
||||||
dashboard_uid = substr(
|
dashboard_uid = substr(
|
||||||
regexreplace(
|
replace(
|
||||||
lower(
|
lower(
|
||||||
"${try(jsondecode(file("${group.dashboard_path_if_exist}/${file}")).uid, trimsuffix(basename(file), ".json"))}_${group.dashboard_path_if_exist}/${file}"
|
"${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,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user