-
Notifications
You must be signed in to change notification settings - Fork 89
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 Traffic Filter data source #619
Add Traffic Filter data source #619
Conversation
…ter to fetch the name
List all rulesets then do client side filtering on the name I think is the only solution at the moment. |
…e of the filter we're looking for
@andrew-moldovan , I think it makes sense to add unit tests for |
Yep, I will add tests still, and expose more of the attributes. Just struggling with Go and learning how this all works, so progress is a bit slow |
…ing more of the properties of the ruleset, though not yet complete
@dimuon could you please take a look at the test I have tried to write? I am struggling with types, figuring out how they all go and why they're so awful 😂 I feel like what I have should theoretically work, but it's yelling about something |
Ok so I've got the unit tests up and running and working on the acceptance tests. Couple things:
|
@andrew-moldovan, the first issue should be already fixed in master branch.
…On Thu, 20 Apr 2023 at 18:54, Andrew Moldovan ***@***.***> wrote:
Ok so I've got the unit tests up and running and working on the acceptance
tests. Couple things:
1. Almost all of them seem to be failing and I have a hard time
believing that adding an extra data source has made them all fail. They're
all failing with After applying this test step, the plan was not empty
and it looks like they might be trying to add apm_secret_token?
2. For my actual acceptance test, I basically want to make sure it can
filter by id/name/region (or even just one of them) and return the number
of rulesets I expect and some details of the ruleset. However, I'm not sure
what account is being used and if this is checking our QA? or Staging? Can
I add a single traffic filter that I can make sure won't be deleted? Right
now there seems to be 42 rulesets for us-east-1 so I'm worried that
isn't likely to be a stable number. I see that the datasource_stack
test essentially just checks to see if version is set but doesn't
check to *what* it's set. I guess I could use something similar, ie
just make sure that *some* rulesets are returned? But even that could
be screwed if all the rulesets are deleted by some other process.
Any ideas @tobio <https://github.com/tobio> @dimuon
<https://github.com/dimuon>
—
Reply to this email directly, view it on GitHub
<#619 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACEMA64XNJNL5JUCTY5U4N3XCFS35ANCNFSM6AAAAAAW5M45KQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@andrew-moldovan , can you leverage |
…n using that to query in the data source
…ithub.com/andrew-moldovan/terraform-provider-ec into elastic#405-add-traffic-filter-datasource
@dimuon ah yes good call. I think I've got that working 🎉 Marking this as ready to review now |
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.
We should add some docs for this data source.
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.
Small docs change, but lgtm. We should be generating these docs so happy to leave this as is for now and hopefully someo can automate it soon.
* `region` (Optional) - Region where the traffic filter is. For Elastic Cloud Enterprise (ECE) installations, use `"ece-region`. | ||
|
||
## Attributes Reference | ||
See https://www.elastic.co/guide/en/cloud/current/definitions.html#TrafficFilterRulesets for the API guide |
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.
See https://www.elastic.co/guide/en/cloud/current/definitions.html#TrafficFilterRulesets for the API guide | |
See the [API guide](https://www.elastic.co/guide/en/cloud/current/definitions.html#TrafficFilterRulesets) for the available fields. |
Although it would be better to document the actual structure here instead.
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.
I deliberately didn't document the actual structure here because I felt that wasn't the right choice. Why am I copy/pasting the structure from the link and writing up my own descriptions (or copying them) when that structure could change or new things added or descriptions changed? Then we'd have to remember to update them in these docs as well instead of just having people visit the one source of truth
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.
Just re-read your comment about autogenerating these docs and I totally agree with that!
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.
when that structure could change or new things added or descriptions changed
Because API structure changes aren't automatically reflected here. We'd have to add those fields to the provider as well.
First contribution to this project so I'm approaching it slowly. The current implementation is super simple and just fetches the name when provided with an ID. (Also I'm sure there's a million things wrong with it still, never written Go before or touched the TF provider).
The reason behind this PR is #405. The ask there is to be able to fetch the
id
based on thename
, so reverse of what I have now. The problem is that I'm not sure we have an API that can do that? Anyone got any ideas?/cc @dimuon @tobio
Description
Related Issues
Motivation and Context
How Has This Been Tested?
Types of Changes
Readiness Checklist