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 thefrequency field in the Create Rule API #753

Merged
merged 11 commits into from
Sep 9, 2024

Conversation

adcoelho
Copy link
Contributor

@adcoelho adcoelho commented Sep 5, 2024

related to kibana/#186963

Summary

As a follow-up to what was done in #715 I am now adding support for another field.

Testing notes

I could not update the TestAccResourceAlertingRule tests in internal/kibana/alerting_test.go because this new field needs the actions block that requires the ID of an existing connector.

(We already supported the actions field but those were not included in the tests in the initial PR and I think the reasoning was the same. Maybe @tobio knows?).

To test I started Kibana locally and configured an MS Teams connector manually.

I then updated the test resources with the new fields and my connector ID and ran make testacc TESTARGS='-run ^TestAccResourceAlertingRule$$', which worked as expected.

Additionally, I added the file resource_rule_action_frequency.tf and tested it with Terraform CLI. (I substituted elasticstack_kibana_action_connector.index_example.connector_id for my connector ID).

I also updated the tests in internal/clients/kibana/alerting_test.go to include all possible combinations of the new fields in the Rule API responses.

@adcoelho adcoelho self-assigned this Sep 5, 2024
@adcoelho adcoelho requested review from tobio and dimuon September 5, 2024 13:05
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.

I could not update the TestAccResourceAlertingRule tests in internal/kibana/alerting_test.go because this new field needs the actions block that requires the ID of an existing connector.

IIRC alert management was implemented before connector management. Now that we have the connector resource I think we should update the acceptance tests to create say a server_log connector so we can reference that in the actions. WDYT?

internal/clients/kibana/alerting.go Outdated Show resolved Hide resolved
internal/clients/kibana/alerting.go Outdated Show resolved Hide resolved
internal/kibana/alerting.go Outdated Show resolved Hide resolved
@adcoelho
Copy link
Contributor Author

adcoelho commented Sep 9, 2024

@tobio

Now that we have the connector resource I think we should update the acceptance tests to create say a server_log connector so we can reference that in the actions. WDYT?

Ah nice, I hadn't noticed the connector.go file! I can update TestAccResourceAlertingRule to include the actions but is it ok if I do that in my next PR? I have one last field to add to this resource and I can do the tests together then.

tobio
tobio previously approved these changes Sep 9, 2024
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

Let's add a note about notify_when being required in 8.5 and lower and add some validation in the resource code itself enforcing that.

@tobio tobio merged commit 7802f4c into elastic:main Sep 9, 2024
20 checks passed
tobio added a commit to jdesnoes/terraform-provider-elasticstack that referenced this pull request Sep 11, 2024
…-data-source

* origin/main: (23 commits)
  Migrate index resource to plugin framework (elastic#698)
  Remove duplicate code (elastic#761)
  fix(deps): update module github.com/hashicorp/terraform-plugin-framework-jsontypes to v0.2.0 (elastic#760)
  fix(deps): update module github.com/golangci/golangci-lint to v1.61.0 (elastic#759)
  Add support for the`frequency` field in the Create Rule API (elastic#753)
  Prevent a provider panic when the referenced snapshot repo does not exist (elastic#758)
  remove space_id paramter from private locations (elastic#733)
  chore(deps): update dependency go to v1.23.1 (elastic#755)
  chore(deps): update docker.elastic.co/elasticsearch/elasticsearch docker tag to v8.15.1 (elastic#756)
  chore(deps): update golang:latest docker digest to 4a3c2bc (elastic#754)
  chore(deps): update docker.elastic.co/kibana/kibana docker tag to v8.15.1 (elastic#757)
  Fixup error handling during saved object imports (elastic#738)
  fix(deps): update module github.com/goreleaser/goreleaser to v2 (elastic#748)
  chore(deps): update golangci/golangci-lint-action action to v6 (elastic#746)
  chore(deps): update codecov/codecov-action action to v4 (elastic#745)
  fix(deps): update module github.com/go-resty/resty/v2 to v2.14.0 (elastic#741)
  chore(deps): update actions/setup-go action to v5 (elastic#744)
  chore(deps): update actions/checkout action to v4 (elastic#743)
  fix(deps): update module github.com/deepmap/oapi-codegen/v2 to v2.3.0 (elastic#740)
  chore(deps): update dependency go to v1.23.0 (elastic#739)
  ...
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.

3 participants