From 4db9d22527d11fff2af5b2a6049ec79913903512 Mon Sep 17 00:00:00 2001 From: viktoryathegreat Date: Tue, 25 Jul 2023 12:52:54 +0400 Subject: [PATCH] fix(DMVP-2469): Passed full variable from alerts submodule to the root. --- README.md | 2 +- variables.tf | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ba1deff..9fb8f56 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ No resources. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [alert\_interval\_seconds](#input\_alert\_interval\_seconds) | The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially. | `number` | `10` | no | -| [alert\_rules](#input\_alert\_rules) | This varibale describes alert folders, groups and rules. |
list(object({
name = string # The name of the alert rule
summary = optional(string, "") # Rule annotation as a summary
priority = optional(string, "P2") # Rule priority level: P2 is for non-critical alerts, P1 will be set for critical alerts
folder_name = optional(string, "Main Alerts") # Grafana folder name in which the rule will be created
datasource = string # Name of the datasource used for the alert
metric_name = string # Prometheus metric name which queries the data for the alert
metric_function = optional(string, "") # Prometheus function used with metric for queries, like rate, sum etc.
metric_interval = optional(string, "") # The time interval with using functions like rate
filters = optional(any, {}) # Filters object to identify each service for alerting
function = optional(string, "mean") # One of Reduce functions which will be used in B block for alerting
equation = string # The equation in the math expression which compares B blocks value with a number and generates an alert if needed. Possible values: gt, lt, gte, lte, e.
threshold = number # The value against which B blocks are compared in the math expression
}))
| `[]` | no | +| [alert\_rules](#input\_alert\_rules) | This varibale describes alert folders, groups and rules. |
list(object({
name = string # The name of the alert rule
no_data_state = optional(string, "NoData") # Describes what state to enter when the rule's query returns No Data
exec_err_state = optional(string, "Error") # Describes what state to enter when the rule's query is invalid and the rule cannot be executed
summary = optional(string, "") # Rule annotation as a summary
priority = optional(string, "P2") # Rule priority level: P2 is for non-critical alerts, P1 will be set for critical alerts
folder_name = optional(string, "Main Alerts") # Grafana folder name in which the rule will be created
datasource = string # Name of the datasource used for the alert
expr = optional(string, null) # Full expression for the alert
metric_name = optional(string, "") # Prometheus metric name which queries the data for the alert
metric_function = optional(string, "") # Prometheus function used with metric for queries, like rate, sum etc.
metric_interval = optional(string, "") # The time interval with using functions like rate
filters = optional(any, {}) # Filters object to identify each service for alerting
function = optional(string, "mean") # One of Reduce functions which will be used in B block for alerting
equation = string # The equation in the math expression which compares B blocks value with a number and generates an alert if needed. Possible values: gt, lt, gte, lte, e
threshold = number # The value against which B blocks are compared in the math expression
}))
| `[]` | no | | [notifications](#input\_notifications) | Represents the configuration options for Grafana notification policies. |
object({
contact_point = optional(string, "Slack") # The default contact point to route all unmatched notifications to.
group_by = optional(list(string), ["grafana_folder", "alertname"]) # A list of alert labels to group alerts into notifications by.
group_interval = optional(string, "5m") # Minimum time interval between two notifications for the same group.
repeat_interval = optional(string, "4h") # Minimum time interval for re-sending a notification if an alert is still firing.

policy = optional(object({
contact_point = optional(string, null) # The contact point to route notifications that match this rule to.
continue = optional(bool, false) # Whether to continue matching subsequent rules if an alert matches the current rule. Otherwise, the rule will be 'consumed' by the first policy to match it.
group_by = optional(list(string), [])
mute_timings = optional(list(string), []) # A list of mute timing names to apply to alerts that match this policy.

matcher = optional(object({
label = optional(string, "priority") # The name of the label to match against.
match = optional(string, "=") # The operator to apply when matching values of the given label. Allowed operators are = for equality, != for negated equality, =~ for regex equality, and !~ for negated regex equality.
value = optional(string, "P1") # The label value to match against.
}))
}))
})
| `{}` | no | | [opsgenie\_endpoints](#input\_opsgenie\_endpoints) | OpsGenie contact points list. |
list(object({
name = string # The name of the contact point.
api_key = string # The OpsGenie API key to use.
auto_close = optional(bool, false) # Whether to auto-close alerts in OpsGenie when they resolve in the Alertmanager.
message = optional(string, "") # The templated content of the message.
api_url = optional(string, "https://api.opsgenie.com/v2/alerts") # Allows customization of the OpsGenie API URL.
disable_resolve_message = optional(bool, false) # Whether to disable sending resolve messages.
}))
| `[]` | no | | [slack\_endpoints](#input\_slack\_endpoints) | Slack contact points list. |
list(object({
name = string # The name of the contact point.
endpoint_url = optional(string, "https://slack.com/api/chat.postMessage") # Use this to override the Slack API endpoint URL to send requests to.
icon_emoji = optional(string, "") # The name of a Slack workspace emoji to use as the bot icon.
icon_url = optional(string, "") # A URL of an image to use as the bot icon.
recipient = optional(string, null) # Channel, private group, or IM channel (can be an encoded ID or a name) to send messages to.
text = optional(string, "") # Templated content of the message.
title = optional(string, "") # Templated title of the message.
token = optional(string, "") # A Slack API token,for sending messages directly without the webhook method.
webhook_url = optional(string, "") # A Slack webhook URL,for sending messages via the webhook method.
username = optional(string, "") # Username for the bot to use.
disable_resolve_message = optional(bool, false) # Whether to disable sending resolve messages.
}))
| `[]` | no | diff --git a/variables.tf b/variables.tf index c87048c..2dddbe9 100644 --- a/variables.tf +++ b/variables.tf @@ -7,16 +7,19 @@ variable "alert_interval_seconds" { variable "alert_rules" { type = list(object({ name = string # The name of the alert rule + no_data_state = optional(string, "NoData") # Describes what state to enter when the rule's query returns No Data + exec_err_state = optional(string, "Error") # Describes what state to enter when the rule's query is invalid and the rule cannot be executed summary = optional(string, "") # Rule annotation as a summary priority = optional(string, "P2") # Rule priority level: P2 is for non-critical alerts, P1 will be set for critical alerts folder_name = optional(string, "Main Alerts") # Grafana folder name in which the rule will be created datasource = string # Name of the datasource used for the alert - metric_name = string # Prometheus metric name which queries the data for the alert + expr = optional(string, null) # Full expression for the alert + metric_name = optional(string, "") # Prometheus metric name which queries the data for the alert metric_function = optional(string, "") # Prometheus function used with metric for queries, like rate, sum etc. metric_interval = optional(string, "") # The time interval with using functions like rate filters = optional(any, {}) # Filters object to identify each service for alerting function = optional(string, "mean") # One of Reduce functions which will be used in B block for alerting - equation = string # The equation in the math expression which compares B blocks value with a number and generates an alert if needed. Possible values: gt, lt, gte, lte, e. + equation = string # The equation in the math expression which compares B blocks value with a number and generates an alert if needed. Possible values: gt, lt, gte, lte, e threshold = number # The value against which B blocks are compared in the math expression })) default = []