-
Notifications
You must be signed in to change notification settings - Fork 96
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
[ISSUE-154] Add Watches #155
Conversation
RobsonSutton
commented
Oct 15, 2022
•
edited
Loading
edited
- Add Watches feature, raised under [Feature] Support for Watches #154
- ES Watcher API endpoints: https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api.html
- Fix Logstash Pipelines Import example
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
You should be able to start a trial within the test setup. The API is exposed in the Go client too |
958be2e
to
11777b3
Compare
3c49c29
to
a29b929
Compare
d23dfc7
to
6e5077d
Compare
Hey @tobio! I'm keen to get this one finished before the next version is released of the provider (0.6.0 I'm assuming), did you know when you're planning on rolling out this next version? (just so I know how much time I have to play with!) Note: Am hoping to get this sorted this week anyway but thought I'd check just in case it was to be rolled out imminently! |
Likely 2-3 weeks I think. Would be great to have this one in, thanks @RobsonSutton |
@tobio - Please can you review this one when you have a spare min please? Think it should be nearly there now, just been trying to get the main stuff in place so that it can make it in before the version bump!👍 Things to note:
Any feedback you have for any parts that need to be changed or any potential improvement / better ways of doing things would be greatly appreciated as always! (Also, forgive the no. of commits... 😆 my local machine couldn't handle running the tests and containers under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 couple of comments inline. We could likely address them in a follow up PR aside from the resource level connection properties if you're short on time.
Have tried to keep as close to how they are defined via the UI (in one large JSON string). Happy to rename body -> json_body in case you ever wanted to have both options of either defining it via json or via TF blocks though?
I think we should add the individual properties to this resource eventually, it would help with avoid the issues with applying defaults to the field values. body
should be fine though, it won't conflict with any of the field names.
I have forced the main 4 fields to be required which differs slightly from the API. This is to workaround the issue with these being set to defaults by the API (I played around for quite a while with defining defaults in all manner of ways to try to match this with the API, but figured this would probably just be the best approach in the end since user config will then always match up)
I think this is an ok tradeoff for now. As per above, longer term it feels like it would be nicer to have individual properties for these fields which I think would help solve the dramas here. I was trying to think through using DiffSuppressFunc for these, but it would likely be a lot of complexity for little benefit. Not a huge fan of this requirement, but it does seem like the right approach for now :)
I have not added throttle_period just yet, more due to time than anything else! (this sets throttle_period_in_millis in ES anyway it seems, but just allows for declaration in a more readable format: throttle_period = "10s" == throttle_period_in_millis = 10000)
I'm happy to approve this without it, but if you have time it would be great to support this just to avoid confusion.
Also not sure of the naming standard really for resources so just followed something like this approach: provider_api_package_resource - Looks a little weird with watcher_watch though... I doubt there will be any other resources added in this package either, so happy to rename if you'd prefer 👍
We already have elasticstack_elasticsearch_index
(which would have had a similar stutter), so I think just elasticstack_elasticsearch_watch
is fine.
Will look at this one tomorrow 👍 I guess I was approaching this more from a consumer angle when focusing on the full json body approach, so that any watchers being moved to the provider (as opposed to being created from scratch) would need to be decoded, separated and re-encoded to each of the fields, whereas with body you can just point at a file containing the copy and paste of the UI watcher config. Isn't a massive job for consumers to instrument though so if it offers better control from the provider side then will see if I can quickly rework this one to support individual properties instead!
Will have another look at this one tomorrow too 👍 it is just be a human readable wrapper for |
This sounds like setting |
@tobio - Apologies for the delay, |
This is awesome, thanks for making the time for this contribution. IMO it's much nicer having those fields split out :) |
No problem! 👍 Thanks as always for helping to advise with the Go side of things, is much appreciated! |