From f12ad2ff9d2ddfa7b6cc4b9e8584081446575fa9 Mon Sep 17 00:00:00 2001 From: Fede Barcelona Date: Wed, 11 Feb 2026 09:22:15 +0100 Subject: [PATCH] feat(monitor-alert): support dashboardTemplate link type in alert v2 resources Closes #700 --- sysdig/internal/client/v2/alerts_v2.go | 5 +++-- sysdig/resource_sysdig_monitor_alert_v2_common.go | 1 + sysdig/resource_sysdig_monitor_alert_v2_metric_test.go | 4 ++++ website/docs/r/monitor_alert_v2_change.md | 4 ++-- website/docs/r/monitor_alert_v2_downtime.md | 4 ++-- website/docs/r/monitor_alert_v2_event.md | 4 ++-- website/docs/r/monitor_alert_v2_form_based_prometheus.md | 4 ++-- website/docs/r/monitor_alert_v2_group_outlier.md | 4 ++-- website/docs/r/monitor_alert_v2_metric.md | 4 ++-- website/docs/r/monitor_alert_v2_prometheus.md | 4 ++-- 10 files changed, 22 insertions(+), 16 deletions(-) diff --git a/sysdig/internal/client/v2/alerts_v2.go b/sysdig/internal/client/v2/alerts_v2.go index 556696640..3fd100a0c 100644 --- a/sysdig/internal/client/v2/alerts_v2.go +++ b/sysdig/internal/client/v2/alerts_v2.go @@ -43,8 +43,9 @@ const ( ) const ( - AlertLinkV2TypeDashboard AlertLinkV2Type = "dashboard" - AlertLinkV2TypeRunbook AlertLinkV2Type = "runbook" + AlertLinkV2TypeDashboard AlertLinkV2Type = "dashboard" + AlertLinkV2TypeDashboardTemplate AlertLinkV2Type = "dashboardTemplate" + AlertLinkV2TypeRunbook AlertLinkV2Type = "runbook" ) var labelCache struct { diff --git a/sysdig/resource_sysdig_monitor_alert_v2_common.go b/sysdig/resource_sysdig_monitor_alert_v2_common.go index c3c3057d8..259e90a6b 100644 --- a/sysdig/resource_sysdig_monitor_alert_v2_common.go +++ b/sysdig/resource_sysdig_monitor_alert_v2_common.go @@ -216,6 +216,7 @@ func AlertV2SeverityValues() []string { func AlertLinkV2TypeValues() []string { return []string{ string(v2.AlertLinkV2TypeDashboard), + string(v2.AlertLinkV2TypeDashboardTemplate), string(v2.AlertLinkV2TypeRunbook), } } diff --git a/sysdig/resource_sysdig_monitor_alert_v2_metric_test.go b/sysdig/resource_sysdig_monitor_alert_v2_metric_test.go index be5094d88..4b15482ca 100644 --- a/sysdig/resource_sysdig_monitor_alert_v2_metric_test.go +++ b/sysdig/resource_sysdig_monitor_alert_v2_metric_test.go @@ -469,6 +469,10 @@ resource "sysdig_monitor_alert_v2_metric" "sample" { type = "dashboard" id = sysdig_monitor_dashboard.dashboard.id } + link { + type = "dashboardTemplate" + id = "view.promcat.mysql" + } } `, name, name, name) } diff --git a/website/docs/r/monitor_alert_v2_change.md b/website/docs/r/monitor_alert_v2_change.md index ff172fe19..5b475bfeb 100644 --- a/website/docs/r/monitor_alert_v2_change.md +++ b/website/docs/r/monitor_alert_v2_change.md @@ -97,9 +97,9 @@ By defining this field, the user can modify the title and the body of the messag By defining this field, the user can add link to notifications. -* `type` - (Required) Type of link. Must be `runbook`, for generic links, or `dashboard`, for internal links to existing dashboards. +* `type` - (Required) Type of link. Must be `runbook` for generic links, `dashboard` for internal links to existing dashboards, or `dashboardTemplate` for links to dashboard templates. * `href` - (Optional) When using `runbook` type, url of the external resource. -* `id` - (Optional) When using `dashboard` type, dashboard id. +* `id` - (Optional) When using `dashboard` type, dashboard id. When using `dashboardTemplate` type, the dashboard template id (e.g. `view.promcat.mysql`). ### Percentage of Change alert arguments diff --git a/website/docs/r/monitor_alert_v2_downtime.md b/website/docs/r/monitor_alert_v2_downtime.md index 6300085cc..a562a14db 100644 --- a/website/docs/r/monitor_alert_v2_downtime.md +++ b/website/docs/r/monitor_alert_v2_downtime.md @@ -83,9 +83,9 @@ By defining this field, the user can modify the title and the body of the messag By defining this field, the user can add link to notifications. -* `type` - (Required) Type of link. Must be `runbook`, for generic links, or `dashboard`, for internal links to existing dashboards. +* `type` - (Required) Type of link. Must be `runbook` for generic links, `dashboard` for internal links to existing dashboards, or `dashboardTemplate` for links to dashboard templates. * `href` - (Optional) When using `runbook` type, url of the external resource. -* `id` - (Optional) When using `dashboard` type, dashboard id. +* `id` - (Optional) When using `dashboard` type, dashboard id. When using `dashboardTemplate` type, the dashboard template id (e.g. `view.promcat.mysql`). ### `capture` diff --git a/website/docs/r/monitor_alert_v2_event.md b/website/docs/r/monitor_alert_v2_event.md index 389091912..dd6611c5f 100644 --- a/website/docs/r/monitor_alert_v2_event.md +++ b/website/docs/r/monitor_alert_v2_event.md @@ -95,9 +95,9 @@ By defining this field, the user can modify the title and the body of the messag By defining this field, the user can add link to notifications. -* `type` - (Required) Type of link. Must be `runbook`, for generic links, or `dashboard`, for internal links to existing dashboards. +* `type` - (Required) Type of link. Must be `runbook` for generic links, `dashboard` for internal links to existing dashboards, or `dashboardTemplate` for links to dashboard templates. * `href` - (Optional) When using `runbook` type, url of the external resource. -* `id` - (Optional) When using `dashboard` type, dashboard id. +* `id` - (Optional) When using `dashboard` type, dashboard id. When using `dashboardTemplate` type, the dashboard template id (e.g. `view.promcat.mysql`). ### `capture` diff --git a/website/docs/r/monitor_alert_v2_form_based_prometheus.md b/website/docs/r/monitor_alert_v2_form_based_prometheus.md index c10674742..88eb964ea 100644 --- a/website/docs/r/monitor_alert_v2_form_based_prometheus.md +++ b/website/docs/r/monitor_alert_v2_form_based_prometheus.md @@ -76,9 +76,9 @@ By defining this field, the user can modify the title and the body of the messag By defining this field, the user can add link to notifications. -* `type` - (Required) Type of link. Must be `runbook`, for generic links, or `dashboard`, for internal links to existing dashboards. +* `type` - (Required) Type of link. Must be `runbook` for generic links, `dashboard` for internal links to existing dashboards, or `dashboardTemplate` for links to dashboard templates. * `href` - (Optional) When using `runbook` type, url of the external resource. -* `id` - (Optional) When using `dashboard` type, dashboard id. +* `id` - (Optional) When using `dashboard` type, dashboard id. When using `dashboardTemplate` type, the dashboard template id (e.g. `view.promcat.mysql`). ### Threshold Prometheus alert arguments diff --git a/website/docs/r/monitor_alert_v2_group_outlier.md b/website/docs/r/monitor_alert_v2_group_outlier.md index 5a51652d8..a90085dba 100644 --- a/website/docs/r/monitor_alert_v2_group_outlier.md +++ b/website/docs/r/monitor_alert_v2_group_outlier.md @@ -97,9 +97,9 @@ By defining this field, the user can modify the title and the body of the messag By defining this field, the user can add link to notifications. -* `type` - (Required) Type of link. Must be `runbook`, for generic links, or `dashboard`, for internal links to existing dashboards. +* `type` - (Required) Type of link. Must be `runbook` for generic links, `dashboard` for internal links to existing dashboards, or `dashboardTemplate` for links to dashboard templates. * `href` - (Optional) When using `runbook` type, url of the external resource. -* `id` - (Optional) When using `dashboard` type, dashboard id. +* `id` - (Optional) When using `dashboard` type, dashboard id. When using `dashboardTemplate` type, the dashboard template id (e.g. `view.promcat.mysql`). ### `capture` diff --git a/website/docs/r/monitor_alert_v2_metric.md b/website/docs/r/monitor_alert_v2_metric.md index 96c151e15..6f637f876 100644 --- a/website/docs/r/monitor_alert_v2_metric.md +++ b/website/docs/r/monitor_alert_v2_metric.md @@ -112,9 +112,9 @@ By defining this field, the user can modify the title and the body of the messag By defining this field, the user can add link to notifications. -* `type` - (Required) Type of link. Must be `runbook`, for generic links, or `dashboard`, for internal links to existing dashboards. +* `type` - (Required) Type of link. Must be `runbook` for generic links, `dashboard` for internal links to existing dashboards, or `dashboardTemplate` for links to dashboard templates. * `href` - (Optional) When using `runbook` type, url of the external resource. -* `id` - (Optional) When using `dashboard` type, dashboard id. +* `id` - (Optional) When using `dashboard` type, dashboard id. When using `dashboardTemplate` type, the dashboard template id (e.g. `view.promcat.mysql`). ### `capture` diff --git a/website/docs/r/monitor_alert_v2_prometheus.md b/website/docs/r/monitor_alert_v2_prometheus.md index 7692f52a3..a837b4c8e 100644 --- a/website/docs/r/monitor_alert_v2_prometheus.md +++ b/website/docs/r/monitor_alert_v2_prometheus.md @@ -76,9 +76,9 @@ By defining this field, the user can modify the title and the body of the messag By defining this field, the user can add link to notifications. -* `type` - (Required) Type of link. Must be `runbook`, for generic links, or `dashboard`, for internal links to existing dashboards. +* `type` - (Required) Type of link. Must be `runbook` for generic links, `dashboard` for internal links to existing dashboards, or `dashboardTemplate` for links to dashboard templates. * `href` - (Optional) When using `runbook` type, url of the external resource. -* `id` - (Optional) When using `dashboard` type, dashboard id. +* `id` - (Optional) When using `dashboard` type, dashboard id. When using `dashboardTemplate` type, the dashboard template id (e.g. `view.promcat.mysql`). ### Prometheus alert arguments