terraform-provider-sumologic
terraform-provider-sumologic copied to clipboard
Trigger conditions/resolution/occurence_type not updated correctly in terraform plan
Steps to reproduce
- Define new sumologic_monitor with metrics_static_condition as trigger_conditions. Inside resolution object do NOT specify occurence_type. E.g.:
resource "sumologic_monitor" "tf_test_to_be_removed" {
name = "Test"
description = "Test"
type = "MonitorsLibraryMonitor"
is_disabled = false
content_type = "Monitor"
monitor_type = "Metrics"
evaluation_delay = "1m"
queries {
row_id = "A"
query = "metric=CPU* _sourceCategory=event-action"
}
trigger_conditions {
metrics_static_condition {
warning {
time_range = "15m"
occurrence_type = "Always"
alert {
threshold = 40.0
threshold_type = "GreaterThan"
}
resolution {
threshold = 40.0
threshold_type = "LessThanOrEqual"
}
}
}
}
}
-
terraform apply
- Add to resolution object `occurrence_type= "AtLeastOnce"
-
terraform apply
Observed
terraform plan
outputs the addition of occurrence_type
again. It won't change after subsequent applies either.
However, the value was updated in the backend.
Expected
terraform plan
should output 0 changes after the second apply
.
Code pointers
It appears that here we leave out some case during reading monitor from JSON: https://github.com/SumoLogic/terraform-provider-sumologic/blob/34d00d8271b04c32f9dd8c801ebb0914ac3768b5/sumologic/resource_sumologic_monitors_library_monitor.go#L1152
Internal JIRA SUMO-202978