Closed DanielGarzaFraireDF closed 4 months ago
Sorry, but this is working as expected. We don't plan on silently skipping invalid configurations. I suggest you change your for_each to avoid including invalid event_query
blocks, either by making the variables block dynamic, or having a conditional that sets variables to null if the monitor doesn't have an applicable event_query
definition
We already tried making this variables NULL when not needed by some monitors but DD its still looking for it This is the message we are receiving.
"variables.0.event_query.0.data_source" is required, but no │ definition was found"
This is in fact the real issue, not accepting the NULL for this variables
Try using something like the following:
dynamic "variables" {
for_each = each.value.variables_name != null ? [1] : []
content {
event_query {
name = each.value.variables_name
data_source = each.value.data_source
search {
query = each.value.search_query
}
compute {
aggregation = each.value.aggregation
}
}
}
}
instead of explicitly defining the variables block. This dynamic block will omit the variables block if each.value.variables_name
is null.
Thanks a lot @nkzou !
That solved our problem and now our integration is working as expected with this dynamic block
Greetings!
Datadog Terraform Provider Version
3.39.0
Terraform Version
1.8.5
What resources or data sources are affected?
resource_datadog_monitor
Terraform Configuration Files
Relevant debug or panic output
No response
Expected Behavior
Terraform should create a list of monitors regardless of whether they have some attributes set or not
We are having this issue with this attributes:
Actual Behavior
Datadog is having some attributes as "required" even when the default is null and we can
The argument "variables.0.event_query.0.search.0.query" is required, but no │ definition was found.
Steps to Reproduce
resource "datadog_monitor" "monitor" {
}
Important Factoids
No response
References
No response