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

feat: add 'netbox_ip_address_assignment' resource (#601) #602

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skoppe
Copy link

@skoppe skoppe commented Jun 3, 2024

Adds netbox_ip_address_assignment resource which:

Assigns a NetBox Device, physical or virtual, to an already constructed IP address.

In cases where the device assigned to the IP Address is not yet known when constructing the IP address (using either netbox_available_ip_address or netbox_ip_address), this resource allows assigning it afterwards.

A typical scenario is when you statically allocate IP's to virtual machines and use netbox_available_ip_address to fetch that IP, but where the netbox_virtual_machine or netbox_interface can only be constructed after having started the virtual machine.`

No idea on the docs, the makefile produces garbage.

@fbreckle
Copy link
Collaborator

fbreckle commented Jun 3, 2024

Doesn't this resource introduce drift in the initial netbox_available_ip_address resource?

@skoppe
Copy link
Author

skoppe commented Jun 3, 2024

Doesn't this resource introduce drift in the initial netbox_available_ip_address resource?

I expected so myself as well, but for some reason it doesn't. I ran it against a staging environment with plenty of other resources and saw no drift.

I'll spend some time thinking it through. In the meantime, is something else missing here, or is this good to go?

@skoppe
Copy link
Author

skoppe commented Jun 3, 2024

Ah, alas, if I set some additional field on the original netbox_ip_address and apply again it overwrites any assignment set via netbox_ip_address_assigment.

Bummer. This is a bit unfortunate since the netbox api does allow updating entities partially but somehow that capability isn't available in the go api.

@skoppe
Copy link
Author

skoppe commented Jul 15, 2024

As mentioned in #613

This PR has one issue left to tackle: any assignment can be left undone after changes to either ip resource.

What needs to be done is to add an external_assignment boolean to both ip resources, so it knows to avoid updating/clearing any assignment.

@skoppe
Copy link
Author

skoppe commented Sep 16, 2024

@fbreckle please review again. I have added a external_assignment boolean to the netbox_ip_address and netbox_available_ip_address resource to avoid conflicts with netbox_ip_address_assignment.

@skoppe skoppe marked this pull request as ready for review October 10, 2024 21:09
@MiBUl-eu
Copy link

Are there any news on that MR?

@skoppe can you rebase your branch with the master branch?

@skoppe
Copy link
Author

skoppe commented Oct 28, 2024

Are there any news on that MR?

@skoppe can you rebase your branch with the master branch?

Sure, let me do later today.

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

Successfully merging this pull request may close these issues.

3 participants