Skip to content

Support alerting rules with only one of kql or timeframe fields #886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 31, 2024

Conversation

tobio
Copy link
Member

@tobio tobio commented Oct 29, 2024

Fixes #874

Ensure that KQL and Timeframe fields are only populated if they're actually set in the TF module.

@tobio tobio self-assigned this Oct 29, 2024
@tobio tobio force-pushed the kibana-alerting-optional-kql-timeframe branch from 0dde820 to b1334f7 Compare October 30, 2024 04:09
resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "actions.0.alerts_filter.0.timeframe.0.timezone", "Pacific/Honolulu"),
resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "actions.0.alerts_filter.0.timeframe.0.hours_start", "02:00"),
resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "actions.0.alerts_filter.0.timeframe.0.hours_end", "03:00"),
resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "actions.0.alerts_filter.0.timeframe.#", "0"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the .#? length of the array?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, exactly.

Comment on lines 430 to 432
timezone = "Africa/Accra"
hours_start = "01:00"
hours_end = "07:00"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: now it's misaligned with days 😅

adcoelho
adcoelho previously approved these changes Oct 30, 2024
@tobio tobio merged commit febff3f into main Oct 31, 2024
41 checks passed
@tobio tobio deleted the kibana-alerting-optional-kql-timeframe branch October 31, 2024 00:55
kjwardy pushed a commit to kjwardy/terraform-provider-elasticstack that referenced this pull request Nov 19, 2024
…tic#886)

* Support alerting rules with only one of kql or timeframe fields

* CHANGELOG.md

* Fix tests

* Fix alignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Kibana alert rule - Clarification for "alerts_filter" issue when using either "kql" or "timeframe" in Terraform
2 participants