Hi Guys,
I am trying to create nrql alerts dynamically by passing a complex object i.e.
variable “newrelic_nrql_alert_condition” {
description = “set dynamic nrql alerts”
type = list(object({
policy_id = string,
type = string,
name = string,
violation_time_limit = string,
nrql = object({
query = string,
evaluation_offset = number
}),
critical = object({
operator = string,
threshold = number,
threshold_duration = number,
threshold_occurrences = string
}),
warning = object({
operator = string,
threshold = number,
threshold_duration = number,
threshold_occurrences = string
})
}))
}
I am not sure how i can process the maps inside this object when i create the resource.
It look like the object is there as per the error message each.value is object with 7 attributes
Error: Unsupported attribute
on .terraform/modules/service-monitoring/alerts.tf line 167, in resource “newrelic_nrql_alert_condition” “nrql_alert”:
167: query = each.value.query
|----------------
| each.value is object with 7 attributes
This object does not have an attribute named “query”.
Any help is highly appreciated.
Cheers