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

[Feature request] - Support custom fields and multiple tags in netbox_prefixes datasource filter #425

Open
tgoff opened this issue Jul 5, 2023 · 2 comments

Comments

@tgoff
Copy link

tgoff commented Jul 5, 2023

Terraform Version

Terraform v1.4.0
on darwin_amd64

  • provider registry.terraform.io/e-breuninger/netbox v3.2.1

Affected Resource(s)

Please list the resources as a list, for example:

  • netbox_prefixes

Proposed Functionality

netbox_prefixes should allow filtering of prefixes by custom fields as well as by more than one tag.

In addition, depth and length would be useful to filter on as well.

Justification/Use Case

We have a hierarchy of prefixes with a /14 representing a top level grouping, /16 a secondary level, and tenant groups get ranges below that. These groupings are represented in netbox via custom fields and/or tags. When finding an available prefix for a new tenant, it is not currently possible via the netbox_prefixes datasource to find the appropriate parent prefix e.g:

give me the /16 prefix which has these custom field values or these multiple tags

The best solution we can find so far is to aggregate multiple custom fields into a single tag and use that to filter, which is not ideal.

@tgoff
Copy link
Author

tgoff commented Jul 6, 2023

I tried my hand at getting multiple tags working and will submit a PR once I add tests and possibly try to address some of the other proposed fields. I can see it is hard to chose which of the MANY available fields to expose via this datasource and why it isnt practical to support them all

@tgoff
Copy link
Author

tgoff commented Jul 14, 2023

PR to implicitly enable all standard fields (not just the small number currently explicitly supported) and allow multiple tag filters. Haven't been able to get custom fields working though:
#428

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

1 participant