Skip to content
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

Add support for the alerts_filter param in the Create Rule API #774

Merged
merged 6 commits into from
Sep 19, 2024

Conversation

adcoelho
Copy link
Contributor

Related to kibana/#186963

Summary

Follow-up to #715 and #753. This should be the last PR 🎉

I will update the documentation next.

Since we now support the connector resource I also added tests for the actions and the frequency(as discussed here).

@adcoelho adcoelho requested a review from tobio September 16, 2024 15:28
@adcoelho
Copy link
Contributor Author

The failing tests are because the new field wasn't available initially for all rule types.

I am trying to rewrite the tests with a rule type that works in every version.

It shouldn't affect the review 🙌

@lcawl
Copy link
Contributor

lcawl commented Sep 17, 2024

The text fields LGTM

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

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

LGTM, can you add a changelog entry for this as well.

return nil, []error{fmt.Errorf("%q string is not a valid time in HH:mm format: [empty]", k)}
}

r := regexp.MustCompile(`^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$`)
Copy link
Member

Choose a reason for hiding this comment

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

This will accept 1:10 but not 10:1 which feels a bit inconsistent. I don't feel strongly here, but maybe we should just enforce two digit hours as the simplest option?

Copy link
Contributor Author

@adcoelho adcoelho Sep 19, 2024

Choose a reason for hiding this comment

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

This is a good point but if anything I don't like that we allow 1:10 😅 So I could alternatively do:

Suggested change
r := regexp.MustCompile(`^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$`)
r := regexp.MustCompile(`^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$`)

But this is exactly the same validation we have in the rule API so I'm not sure it is worth it.

Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

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

Great work!!

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

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

🚢

- Add the `alert_delay` field to the Create Rule API ([#715](https://github.com/elastic/terraform-provider-elasticstack/pull/715))
- Add support for data_stream `lifecycle` template settings ([#724](https://github.com/elastic/terraform-provider-elasticstack/pull/724))
- Fix a provider panic when `elasticstack_kibana_action_connector` reads a non-existant connector ([#729](https://github.com/elastic/terraform-provider-elasticstack/pull/729))
- Add support for `remote_indicies` to `elasticstack_elasticsearch_security_role` & `elasticstack_kibana_security_role` (#723)[https://github.com/elastic/terraform-provider-elasticstack/pull/723]
- Fix error handling in `elasticstack_kibana_import_saved_objects` ([#738](https://github.com/elastic/terraform-provider-elasticstack/pull/738))
- Remove `space_id` parameter from private locations to fix inconsistent state for `elasticstack_kibana_synthetics_private_location` `space_id` ([#733](https://github.com/elastic/terraform-provider-elasticstack/pull/733))
Copy link
Member

Choose a reason for hiding this comment

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

I genuinely like seeing other people have their editors configured to trim trailing whitepace.

@tobio tobio merged commit 9d8c7bd into elastic:main Sep 19, 2024
20 checks passed
tobio added a commit that referenced this pull request Sep 30, 2024
* origin/main: (39 commits)
  chore(deps): update golang:1.23.1 docker digest to 4f063a2 (#804)
  fix(deps): update module github.com/go-resty/resty/v2 to v2.15.3 (#781)
  fix for http/tcp monitor produces inconsistent result after apply (#801)
  chore(deps): update docker.elastic.co/elasticsearch/elasticsearch docker tag to v8.15.2 (#798)
  chore(deps): update docker.elastic.co/kibana/kibana docker tag to v8.15.2 (#799)
  Bump github.com/oapi-codegen/oapi-codegen/v2 in /tools (#808)
  Bump github.com/oapi-codegen/oapi-codegen/v2 from 2.4.0 to 2.4.1 (#806)
  Bump actions/checkout from 4.1.7 to 4.2.0 (#807)
  more fleet framework migrations (#785)
  Apply the sys_monitoring attribute during creation (#792)
  fix(deps): update module github.com/oapi-codegen/oapi-codegen/v2 to v2.4.0 (#788)
  fix(docs): indices datesource example field (#786)
  fix(deps): update module github.com/hashicorp/terraform-plugin-framework to v1.12.0 (#782)
  chore(deps): pin golang docker tag to 2fe82a3 (#783)
  Remove GO_VERSION indirection
  Fix release pipeline
  Prepare release v0.11.7
  fix(deps): update module github.com/goreleaser/goreleaser/v2 to v2.3.2 (#776)
  impl framework data_source.fleet_enrollment_tokens (#778)
  Add support for the `alerts_filter` param in the Create Rule API (#774)
  ...
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.

4 participants