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

is_pool issue with netbox_available_prefix #109

Closed
cova-fe opened this issue Jan 14, 2022 · 4 comments
Closed

is_pool issue with netbox_available_prefix #109

cova-fe opened this issue Jan 14, 2022 · 4 comments

Comments

@cova-fe
Copy link
Contributor

cova-fe commented Jan 14, 2022

Terraform Version

Terraform v1.1.2

Affected Resource(s)

  • netbox_available_prefix

Expected Behavior

the state of is_pool should be changed from true->false

Actual Behavior

The is_pool is not changed

Steps to Reproduce

Run terraform in order to request a new prefix, with is_pool set to true. Subsequently change the tf file to "is_bool: false". tf plan shows that the resource should be updated (true->false) as expected. run tf apply, the output shows that netbox is indeed called against the affected resources. However, the flag is not updated.

Important Factoids

I sniffed the API calls and while the provider indeed contacts the API, the json in the PUT call does not contains "is_pool" flag, that looks suspicious. (attaching the wireshark output as screenshot, as the text output from tcpdump is a bit complicated to format)
image

  • Please note that I'm using netbox 3.1.5, not 3.1.3 even though this should have no impact on this behavior, AFAIK.
@fbreckle
Copy link
Collaborator

fbreckle commented Jan 14, 2022

I'm pretty sure that this issue comes from a common problem with the go-netbox library. This happens because, for bool variables, false is not marshalled into JSON if omitempty is set in the struct definition.

This is one of the reasons I maintain my own fork at fbreckle/go-netbox. This has to be fixed there.

@cova-fe
Copy link
Contributor Author

cova-fe commented Jan 14, 2022

Will you look at it or should I have a look at the code?

@cova-fe
Copy link
Contributor Author

cova-fe commented Jan 15, 2022

I'm pretty sure that this issue comes from a common problem with the go-netbox library. This happens because, for bool variables, false is not marshalled into JSON if omitempty is set in the struct definition.

This is one of the reasons I maintain my own fork at fbreckle/go-netbox. This has to be fixed there.

Could this happen also for other Types? I have to double check, but I suspect that this happens also for (say) vrf_id when from a non-zero value tf wants to change it to 0.

@fbreckle
Copy link
Collaborator

Yes, this happens with many optional attributes. Here is my issue in the original go-netbox repo netbox-community/go-netbox#107

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

2 participants