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

Filters for netbox_devices are undocumented. #570

Open
the-maldridge opened this issue Mar 13, 2024 · 5 comments
Open

Filters for netbox_devices are undocumented. #570

the-maldridge opened this issue Mar 13, 2024 · 5 comments

Comments

@the-maldridge
Copy link

Terraform Version

N/A

Affected Resource(s)

Please list the resources as a list, for example:

  • netbox_devices

Expected Behavior

I would have expected the filter syntax to be the same as that shown in the netbox API playground, but it doesn't seem to be.

Actual Behavior

Some other filter syntax appears to be in use. There should be documentation or examples as to what kind of filters these data sources take.

Steps to Reproduce

I tried with the following filter block:

filter {
  name = "has_primary_ip"
  value = "true"
}

Important Factoids

N/A

References

N/A

@fbreckle
Copy link
Collaborator

Hi,

generally, what you say is true.

You can look up the supported filters here: https://github.com/e-breuninger/terraform-provider-netbox/blob/master/netbox/data_source_netbox_devices.go#L161-L195

Currently, filters have to be implemented manually and implementing ALL supported filters is very chore-y. We have a very nice contribution in #428 to generate support for all filters supported by go-netbox via reflection. I did not yet get around to implementing it everywhere, though.

@the-maldridge
Copy link
Author

Wow, that i impressively labor intensive. I'll work around this for the moment by using an already implemented filter.

@fbreckle
Copy link
Collaborator

Adding a filter is actually quite trivial, but the api exposes SO many possible filters that it really is quite annoying to do :D

@peterbaumert
Copy link

I think going with #428 for all datasources would be a major improvement to this provider.

@fbreckle
Copy link
Collaborator

fbreckle commented Jun 5, 2024

Absolutely! I just can barely keep up with new merge requests and upstream changes (netbox 4.0 comes to mind...)

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

No branches or pull requests

3 participants