|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "grafana_apps_rules_alertrule_v0alpha1 Resource - terraform-provider-grafana" |
| 4 | +subcategory: "Alerting" |
| 5 | +description: |- |
| 6 | + Manages Grafana Alert Rules. |
| 7 | +--- |
| 8 | + |
| 9 | +# grafana_apps_rules_alertrule_v0alpha1 (Resource) |
| 10 | + |
| 11 | +Manages Grafana Alert Rules. |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +resource "grafana_folder" "alertrule_folder" { |
| 17 | + title = "Alert Rule Folder" |
| 18 | +} |
| 19 | +
|
| 20 | +resource "grafana_apps_rules_alertrule_v0alpha1" "example" { |
| 21 | + metadata { |
| 22 | + uid = "example-alert-rule" |
| 23 | + folder_uid = grafana_folder.alertrule_folder.uid |
| 24 | + } |
| 25 | + spec { |
| 26 | + title = "Example Alert Rule" |
| 27 | + trigger { |
| 28 | + interval = "1m" |
| 29 | + } |
| 30 | + paused = true |
| 31 | + expressions = { |
| 32 | + "A" = { |
| 33 | + model = { |
| 34 | + datasource = { |
| 35 | + type = "prometheus" |
| 36 | + uid = "ds_uid" |
| 37 | + } |
| 38 | + editorMode = "code" |
| 39 | + expr = "count(up{})" |
| 40 | + instant = true |
| 41 | + intervalMs = 1000 |
| 42 | + legendFormat = "__auto" |
| 43 | + maxDataPoints = 43200 |
| 44 | + range = false |
| 45 | + refId = "A" |
| 46 | + } |
| 47 | + datasource_uid = "ds_uid" |
| 48 | + relative_time_range = { |
| 49 | + from = "600s" |
| 50 | + to = "0s" |
| 51 | + } |
| 52 | + query_type = "" |
| 53 | + source = true |
| 54 | + } |
| 55 | + "B" = { |
| 56 | + model = { |
| 57 | + conditions = [ |
| 58 | + { |
| 59 | + evaluator = { |
| 60 | + params = [1] |
| 61 | + type = "gt" |
| 62 | + } |
| 63 | + operator = { |
| 64 | + type = "and" |
| 65 | + } |
| 66 | + query = { |
| 67 | + params = ["C"] |
| 68 | + } |
| 69 | + reducer = { |
| 70 | + params = [] |
| 71 | + type = "last" |
| 72 | + } |
| 73 | + type = "query" |
| 74 | + } |
| 75 | + ] |
| 76 | + datasource = { |
| 77 | + type = "__expr__" |
| 78 | + uid = "__expr__" |
| 79 | + } |
| 80 | + expression = "A" |
| 81 | + intervalMs = 1000 |
| 82 | + maxDataPoints = 43200 |
| 83 | + refId = "C" |
| 84 | + type = "threshold" |
| 85 | + } |
| 86 | + datasource_uid = "__expr__" |
| 87 | + query_type = "" |
| 88 | + source = false |
| 89 | + } |
| 90 | + } |
| 91 | + for = "5m" |
| 92 | + labels = { |
| 93 | + severity = "critical" |
| 94 | + } |
| 95 | + annotations = { |
| 96 | + runbook_url = "https://example.com" |
| 97 | + } |
| 98 | + no_data_state = "KeepLast" |
| 99 | + exec_err_state = "KeepLast" |
| 100 | + missing_series_evals_to_resolve = 5 |
| 101 | + notification_settings { |
| 102 | + contact_point = "grafana-default-email" |
| 103 | + } |
| 104 | + } |
| 105 | +} |
| 106 | +``` |
| 107 | + |
| 108 | +<!-- schema generated by tfplugindocs --> |
| 109 | +## Schema |
| 110 | + |
| 111 | +### Optional |
| 112 | + |
| 113 | +- `metadata` (Block, Optional) The metadata of the resource. (see [below for nested schema](#nestedblock--metadata)) |
| 114 | +- `options` (Block, Optional) Options for applying the resource. (see [below for nested schema](#nestedblock--options)) |
| 115 | +- `spec` (Block, Optional) The spec of the resource. (see [below for nested schema](#nestedblock--spec)) |
| 116 | + |
| 117 | +### Read-Only |
| 118 | + |
| 119 | +- `id` (String) The ID of the resource derived from UUID. |
| 120 | + |
| 121 | +<a id="nestedblock--metadata"></a> |
| 122 | +### Nested Schema for `metadata` |
| 123 | + |
| 124 | +Required: |
| 125 | + |
| 126 | +- `uid` (String) The unique identifier of the resource. |
| 127 | + |
| 128 | +Optional: |
| 129 | + |
| 130 | +- `folder_uid` (String) The UID of the folder to save the resource in. |
| 131 | + |
| 132 | +Read-Only: |
| 133 | + |
| 134 | +- `annotations` (Map of String) Annotations of the resource. |
| 135 | +- `url` (String) The full URL of the resource. |
| 136 | +- `uuid` (String) The globally unique identifier of a resource, used by the API for tracking. |
| 137 | +- `version` (String) The version of the resource. |
| 138 | + |
| 139 | + |
| 140 | +<a id="nestedblock--options"></a> |
| 141 | +### Nested Schema for `options` |
| 142 | + |
| 143 | +Optional: |
| 144 | + |
| 145 | +- `overwrite` (Boolean) Set to true if you want to overwrite existing resource with newer version, same resource title in folder or same resource uid. |
| 146 | + |
| 147 | + |
| 148 | +<a id="nestedblock--spec"></a> |
| 149 | +### Nested Schema for `spec` |
| 150 | + |
| 151 | +Required: |
| 152 | + |
| 153 | +- `exec_err_state` (String) Describes what state to enter when the rule's query is invalid and the rule cannot be executed. Options are OK, Error, KeepLast, and Alerting. |
| 154 | +- `expressions` (Dynamic) A sequence of stages that describe the contents of the rule. |
| 155 | +- `no_data_state` (String) Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. |
| 156 | +- `title` (String) The title of the alert rule. |
| 157 | + |
| 158 | +Optional: |
| 159 | + |
| 160 | +- `annotations` (Map of String) Key-value pairs of metadata to attach to the alert rule. They add additional information, such as a `summary` or `runbook_url`, to help identify and investigate alerts. |
| 161 | +- `for` (String) The amount of time for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending. |
| 162 | +- `keep_firing_for` (String) The amount of time for which the rule will considered to be Recovering after initially Firing. Before this time has elapsed, the rule will continue to fire once it's been triggered. |
| 163 | +- `labels` (Map of String) Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. |
| 164 | +- `missing_series_evals_to_resolve` (Number) The number of missing series evaluations that must occur before the rule is considered to be resolved. |
| 165 | +- `notification_settings` (Block, Optional) Notification settings for the rule. If specified, it overrides the notification policies. (see [below for nested schema](#nestedblock--spec--notification_settings)) |
| 166 | +- `panel_ref` (Dynamic) Reference to a panel that this alert rule is associated with. Should be an object with 'dashboard_uid' (string) and 'panel_id' (number) fields. |
| 167 | +- `paused` (Boolean) Sets whether the rule should be paused or not. |
| 168 | +- `trigger` (Block, Optional) The trigger configuration for the alert rule. (see [below for nested schema](#nestedblock--spec--trigger)) |
| 169 | + |
| 170 | +<a id="nestedblock--spec--notification_settings"></a> |
| 171 | +### Nested Schema for `spec.notification_settings` |
| 172 | + |
| 173 | +Required: |
| 174 | + |
| 175 | +- `contact_point` (String) The contact point to route notifications that match this rule to. |
| 176 | + |
| 177 | +Optional: |
| 178 | + |
| 179 | +- `active_timings` (List of String) A list of time interval names to apply to alerts that match this policy to suppress them unless they are sent at the specified time. |
| 180 | +- `group_by` (List of String) A list of alert labels to group alerts into notifications by. |
| 181 | +- `group_interval` (String) Minimum time interval between two notifications for the same group. |
| 182 | +- `group_wait` (String) Time to wait to buffer alerts of the same group before sending a notification. |
| 183 | +- `mute_timings` (List of String) A list of mute timing names to apply to alerts that match this policy. |
| 184 | +- `repeat_interval` (String) Minimum time interval for re-sending a notification if an alert is still firing. |
| 185 | + |
| 186 | + |
| 187 | +<a id="nestedblock--spec--trigger"></a> |
| 188 | +### Nested Schema for `spec.trigger` |
| 189 | + |
| 190 | +Required: |
| 191 | + |
| 192 | +- `interval` (String) The interval at which the alert rule should be evaluated. |
0 commit comments