-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
Description
Problem description
I am unable to create Prometheus Recording Rules using the stackit_observability_alertgroup resource because the resource schema enforces that every rule must be an Alerting Rule.
When I attempt to create a Recording Rule (by omitting alert and trying to use record), Terraform fails because the provider has marked the alert attribute as required.
Since a Prometheus Rule cannot be both an Alert and a Record simultaneously, it is currently impossible to use this resource for Recording Rules, even though the backend API supports them.
Actual Error Log
Error: Incorrect attribute value type
on main.tf line 101, in resource "stackit_observability_alertgroup" "test_recording_rule":
101: rules = [
102: {
103: record = "test_availability"
104: expr = "1"
105: }
106: ]
Inappropriate value for attribute "rules": element 0: attributes "alert" and "expression" are required.
Proposed solution
Please update the stackit_observability_alertgroup resource schema to:
- Make
alertoptional (currently it is required). - Add an optional
recordfield (string). - Add validation to ensure that either
alertorrecordis set (but not both).
This would allow users to define both rule types in the same resource, matching standard Prometheus/Thanos functionality.
resource "stackit_observability_alertgroup" "dns_availability" {
project_id = var.project_id
instance_id = var.instance_id
name = "DNSAvailability"
# Proposed: This should work for Recording Rules
rules = [
{
record = "availability" # <--- Currently triggers "Unsupported argument"
# alert = ... # <--- Currently "Required", making records impossible
expr = "1 - min(dns_query_result_code) by (product)"
labels = {
product = "dns"
}
}
]
}