53 lines
1.4 KiB
HCL
53 lines
1.4 KiB
HCL
# Dashboards with both manual changes allowed and destroy protection
|
|
resource "grafana_dashboard" "dashboards_ignore_and_protect" {
|
|
for_each = { for d in local.dashboards_ignore_and_protect : d.file_path => d }
|
|
|
|
config_json = file(each.value.file_path)
|
|
folder = each.value.folder_id
|
|
org_id = var.org_id
|
|
overwrite = true
|
|
|
|
lifecycle {
|
|
prevent_destroy = true
|
|
ignore_changes = [config_json]
|
|
}
|
|
}
|
|
|
|
# Dashboards with only manual changes allowed
|
|
resource "grafana_dashboard" "dashboards_ignore_only" {
|
|
for_each = { for d in local.dashboards_ignore_only : d.file_path => d }
|
|
|
|
config_json = file(each.value.file_path)
|
|
folder = each.value.folder_id
|
|
org_id = var.org_id
|
|
overwrite = true
|
|
|
|
lifecycle {
|
|
ignore_changes = [config_json]
|
|
}
|
|
}
|
|
|
|
# Dashboards with only destroy protection
|
|
resource "grafana_dashboard" "dashboards_protect_only" {
|
|
for_each = { for d in local.dashboards_protect_only : d.file_path => d }
|
|
|
|
config_json = file(each.value.file_path)
|
|
folder = each.value.folder_id
|
|
org_id = var.org_id
|
|
overwrite = true
|
|
|
|
lifecycle {
|
|
prevent_destroy = true
|
|
}
|
|
}
|
|
|
|
# Standard dashboards without any special lifecycle management
|
|
resource "grafana_dashboard" "dashboards_standard" {
|
|
for_each = { for d in local.dashboards_standard : d.file_path => d }
|
|
|
|
config_json = file(each.value.file_path)
|
|
folder = each.value.folder_id
|
|
org_id = var.org_id
|
|
overwrite = true
|
|
}
|