|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "grafana_asserts_notification_alerts_config Resource - terraform-provider-grafana" |
| 4 | +subcategory: "Asserts" |
| 5 | +description: |- |
| 6 | + Manages Asserts Alert Configurations through Grafana API. |
| 7 | +--- |
| 8 | + |
| 9 | +# grafana_asserts_notification_alerts_config (Resource) |
| 10 | + |
| 11 | +Manages Asserts Alert Configurations through Grafana API. |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +# Basic alert configuration with silencing |
| 17 | +resource "grafana_asserts_notification_alerts_config" "prometheus_remote_storage_failures" { |
| 18 | + name = "PrometheusRemoteStorageFailures" |
| 19 | +
|
| 20 | + match_labels = { |
| 21 | + alertname = "PrometheusRemoteStorageFailures" |
| 22 | + alertgroup = "prometheus.alerts" |
| 23 | + asserts_env = "prod" |
| 24 | + } |
| 25 | +
|
| 26 | + silenced = true |
| 27 | +} |
| 28 | +
|
| 29 | +# High severity alert with specific job and context matching |
| 30 | +resource "grafana_asserts_notification_alerts_config" "error_buildup_notify" { |
| 31 | + name = "ErrorBuildupNotify" |
| 32 | +
|
| 33 | + match_labels = { |
| 34 | + alertname = "ErrorBuildup" |
| 35 | + job = "acai" |
| 36 | + asserts_request_type = "inbound" |
| 37 | + asserts_request_context = "/auth" |
| 38 | + } |
| 39 | +
|
| 40 | + silenced = false |
| 41 | +} |
| 42 | +
|
| 43 | +# Alert with additional labels and custom duration |
| 44 | +resource "grafana_asserts_notification_alerts_config" "payment_test_alert" { |
| 45 | + name = "PaymentTestAlert" |
| 46 | +
|
| 47 | + match_labels = { |
| 48 | + alertname = "PaymentTestAlert" |
| 49 | + additional_labels = "asserts_severity=~\"critical\"" |
| 50 | + alertgroup = "alex-k8s-integration-test.alerts" |
| 51 | + } |
| 52 | +
|
| 53 | + alert_labels = { |
| 54 | + testing = "onetwothree" |
| 55 | + } |
| 56 | +
|
| 57 | + duration = "5m" |
| 58 | + silenced = false |
| 59 | +} |
| 60 | +
|
| 61 | +# Latency alert for shipping service |
| 62 | +resource "grafana_asserts_notification_alerts_config" "high_shipping_latency" { |
| 63 | + name = "high shipping latency" |
| 64 | +
|
| 65 | + match_labels = { |
| 66 | + alertname = "LatencyP99ErrorBuildup" |
| 67 | + job = "shipping" |
| 68 | + asserts_request_type = "inbound" |
| 69 | + } |
| 70 | +
|
| 71 | + silenced = false |
| 72 | +} |
| 73 | +
|
| 74 | +# CPU throttling alert with warning severity |
| 75 | +resource "grafana_asserts_notification_alerts_config" "cpu_throttling_sustained" { |
| 76 | + name = "CPUThrottlingSustained" |
| 77 | +
|
| 78 | + match_labels = { |
| 79 | + alertname = "CPUThrottlingSustained" |
| 80 | + additional_labels = "asserts_severity=~\"warning\"" |
| 81 | + } |
| 82 | +
|
| 83 | + silenced = true |
| 84 | +} |
| 85 | +
|
| 86 | +# Ingress error rate alert |
| 87 | +resource "grafana_asserts_notification_alerts_config" "ingress_error" { |
| 88 | + name = "ingress error" |
| 89 | +
|
| 90 | + match_labels = { |
| 91 | + alertname = "ErrorRatioBreach" |
| 92 | + job = "ingress-nginx-controller-metrics" |
| 93 | + asserts_request_type = "inbound" |
| 94 | + } |
| 95 | +
|
| 96 | + silenced = false |
| 97 | +} |
| 98 | +
|
| 99 | +# MySQL Galera cluster alert |
| 100 | +resource "grafana_asserts_notification_alerts_config" "mysql_galera_not_ready" { |
| 101 | + name = "MySQLGaleraNotReady" |
| 102 | +
|
| 103 | + match_labels = { |
| 104 | + alertname = "MySQLGaleraNotReady" |
| 105 | + } |
| 106 | +
|
| 107 | + silenced = false |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +<!-- schema generated by tfplugindocs --> |
| 112 | +## Schema |
| 113 | + |
| 114 | +### Required |
| 115 | + |
| 116 | +- `name` (String) The name of the alert configuration. |
| 117 | + |
| 118 | +### Optional |
| 119 | + |
| 120 | +- `alert_labels` (Map of String) Labels to add to alerts generated by this configuration. |
| 121 | +- `duration` (String) Duration for which the condition must be true before firing (e.g., '5m', '30s'). Maps to 'for' in Asserts API. |
| 122 | +- `match_labels` (Map of String) Labels to match for this alert configuration. |
| 123 | +- `silenced` (Boolean) Whether this alert configuration is silenced. Defaults to `false`. |
| 124 | + |
| 125 | +### Read-Only |
| 126 | + |
| 127 | +- `id` (String) The ID of this resource. |
| 128 | + |
| 129 | +## Import |
| 130 | + |
| 131 | +Import is supported using the following syntax: |
| 132 | + |
| 133 | +```shell |
| 134 | +terraform import grafana_asserts_notification_alerts_config.name "{{ name }}" |
| 135 | +``` |
0 commit comments