Filter has default when block which makes the filter not behave correctly.
qfliu opened this issue · comments
Edmund commented
For filters, the when block is optional. However, from our testing, if we do not specify when block, the resulting filter would have an empty when block that render the filter useless. The empty when block is not there if we use sensu-go UI to crate it.
Filter terraform code:
resource "sensu_filter" "filter_interval" {
name = "filter_interval"
action = "allow"
expressions = [
"event.check.interval == 10",
"event.check.occurrences == 0 || event.check.occurrences %3 == 0",
]
}
resulting filter config from sensuctl command:
{
"metadata": {
"name": "filter_interval",
"namespace": "test",
"created_by": "admin"
},
"action": "allow",
"expressions": [
"event.check.interval == 10",
"event.check.occurrences == 0 || event.check.occurrences % 3 == 0"
],
"when": {
"days": {}
},
"runtime_assets": null
},
Filter config with same expression using sensu UI:
{
"metadata": {
"name": "manual_filter",
"namespace": "test"
},
"action": "allow",
"expressions": [
"event.check.interval == 10",
"event.check.occurrences == 0 || event.check.occurrences % 3 == 0"
],
"runtime_assets": null
}
Joe Topjian commented
Joe Topjian commented
v0.8.0 has been released. I'm going to close this issue but let me know if you're still running into problems.