Delete IPs by Address #3364

Closed
opened 2025-12-29 18:28:21 +01:00 by adam · 2 comments
Owner

Originally created by @CSimpiFoN on GitHub (Feb 21, 2020).

Environment

  • Python version: 3.6.8
  • NetBox version: v2.7.7

Proposed Functionality

It would be great if IPs could be deleted by their address, not just by their ID.

Use Case

It would be easier to implement in automation solutions, like Terraform, as for example, it has the IP of the machine, so a local provisioner could delete the IP from NetBox on destroying, without any additional help to look up the ID of the address.

Database Changes

N/A

External Dependencies

N/A

Originally created by @CSimpiFoN on GitHub (Feb 21, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.8 * NetBox version: v2.7.7 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality It would be great if IPs could be deleted by their address, not just by their ID. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case It would be easier to implement in automation solutions, like Terraform, as for example, it has the IP of the machine, so a local provisioner could delete the IP from NetBox on destroying, without any additional help to look up the ID of the address. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes N/A <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies N/A
adam closed this issue 2025-12-29 18:28:21 +01:00
Author
Owner

@hSaria commented on GitHub (Feb 21, 2020):

Personal opinion: the ID of the object grants an unequivocal reference to it, irrespective of the data it holds and even after being modified. This ensures consistency between all models, no matter the fields they have.

Along the same vein, one can make an argument that we should be able to delete a device by its asset tag. You see how this can start to get out of hand in terms of consistency and manageability.

In addition, you can create multiples addresses with the same IP in NetBox, so deleting by IP address would fall apart when it comes to those.

I'm no Terraform expert, though I would expect that a provider for NetBox would definitely reference an object's identifier for a particular resource type, much like Amazon's aws_instance resource type.

@hSaria commented on GitHub (Feb 21, 2020): _Personal opinion_: the ID of the object grants an unequivocal reference to it, irrespective of the data it holds and even after being modified. This ensures consistency between all models, no matter the fields they have. Along the same vein, one can make an argument that we should be able to delete a device by its asset tag. You see how this can start to get out of hand in terms of consistency and manageability. In addition, you can create multiples addresses with the same IP in NetBox, so deleting by IP address would fall apart when it comes to those. I'm no Terraform expert, though I would expect that a provider for NetBox would *definitely* reference an object's identifier for a particular resource type, much like Amazon's [`aws_instance`](https://www.terraform.io/docs/providers/aws/d/instance.html) resource type.
Author
Owner

@DanSheps commented on GitHub (Feb 21, 2020):

As @hSaria pointed out, due to the model chosen (primarily, allowing duplicate IPs) we cannot support deletion by IP.

@DanSheps commented on GitHub (Feb 21, 2020): As @hSaria pointed out, due to the model chosen (primarily, allowing duplicate IPs) we cannot support deletion by IP.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3364