* chore(examples): Add import examples for all resources Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> * Add guide: How to import resources Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> --------- Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
3.4 KiB
3.4 KiB
| page_title | subcategory | description |
|---|---|---|
| stackit_observability_logalertgroup Resource - stackit | Observability log alert group resource schema. Used to create alerts based on logs (Loki). Must have a region specified in the provider configuration. |
stackit_observability_logalertgroup (Resource)
Observability log alert group resource schema. Used to create alerts based on logs (Loki). Must have a region specified in the provider configuration.
Example Usage
resource "stackit_observability_logalertgroup" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-log-alert-group"
interval = "60m"
rules = [
{
alert = "example-log-alert-name"
expression = "sum(rate({namespace=\"example\", pod=\"logger\"} |= \"Simulated error message\" [1m])) > 0"
for = "60s"
labels = {
severity = "critical"
},
annotations = {
summary : "example summary"
description : "example description"
}
},
{
alert = "example-log-alert-name-2"
expression = "sum(rate({namespace=\"example\", pod=\"logger\"} |= \"Another error message\" [1m])) > 0"
for = "60s"
labels = {
severity = "critical"
},
annotations = {
summary : "example summary"
description : "example description"
}
},
]
}
# Only use the import statement, if you want to import an existing observability logalertgroup
import {
to = stackit_observability_logalertgroup.import-example
id = "${var.project_id},${var.observability_instance_id},${var.observability_logalertgroup_name}"
}
Schema
Required
instance_id(String) Observability instance ID to which the log alert group is associated.name(String) The name of the log alert group. Is the identifier and must be unique in the group.project_id(String) STACKIT project ID to which the log alert group is associated.rules(Attributes List) Rules for the log alert group (see below for nested schema)
Optional
interval(String) Specifies the frequency at which rules within the group are evaluated. The interval must be at least 60 seconds and defaults to 60 seconds if not set. Supported formats include hours, minutes, and seconds, either singly or in combination. Examples of valid formats are: '5h30m40s', '5h', '5h30m', '60m', and '60s'.
Read-Only
id(String) Terraform's internal resource ID. It is structured as "project_id,instance_id,name".
Nested Schema for rules
Required:
alert(String) The name of the alert rule. Is the identifier and must be unique in the group.expression(String) The LogQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts.
Optional:
annotations(Map of String) A map of key:value. Annotations to add or overwrite for each alertfor(String) Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. Default is 0slabels(Map of String) A map of key:value. Labels to add or overwrite for each alert