Skip to content

fix: suppress DNS name case drift caused by NetBox lowercasing#863

Merged
fbreckle merged 2 commits intoe-breuninger:masterfrom
MrKeiKun:fix/dns-name-case-drift
Apr 20, 2026
Merged

fix: suppress DNS name case drift caused by NetBox lowercasing#863
fbreckle merged 2 commits intoe-breuninger:masterfrom
MrKeiKun:fix/dns-name-case-drift

Conversation

@MrKeiKun
Copy link
Copy Markdown
Contributor

@MrKeiKun MrKeiKun commented Apr 8, 2026

Problem

NetBox automatically converts DNS names to lowercase (see NetBox IP models). When users specify a mixed-case dns_name (e.g. Host.Example.Com), the provider sees a difference between the config value and the stored lowercase value, causing false configuration drift on every subsequent plan.

Solution

Add a DiffSuppressFunc using strings.EqualFold to the dns_name field in both netbox_ip_address and netbox_available_ip_address, suppressing diffs that differ only in case. This mirrors the fix applied to mac_address in #446.

Fixes: #828.

NetBox automatically converts DNS names to lowercase. Add DiffSuppressFunc
using strings.EqualFold to prevent false configuration drift when users
specify mixed-case dns_name values. Fixes e-breuninger#828.
@fbreckle
Copy link
Copy Markdown
Collaborator

fbreckle commented Apr 8, 2026

Can you add a testcase that fails without your fix but works once the fix is applied?

@MrKeiKun
Copy link
Copy Markdown
Contributor Author

MrKeiKun commented Apr 8, 2026

Can you add a testcase that fails without your fix but works once the fix is applied?

sure thing

Comment thread netbox/resource_netbox_ip_address_test.go Outdated
@MrKeiKun MrKeiKun force-pushed the fix/dns-name-case-drift branch from 3edbb72 to bc64e9b Compare April 9, 2026 11:18
Comment thread netbox/resource_netbox_ip_address_test.go
Uses a mixed-case dns_name to verify NetBox's lowercasing does not cause
false configuration drift. Without the DiffSuppressFunc fix, the post-apply
plan check fails with "the plan was not empty".
@MrKeiKun MrKeiKun force-pushed the fix/dns-name-case-drift branch from bc64e9b to 0d95a30 Compare April 17, 2026 16:28
@fbreckle fbreckle merged commit 8257f4d into e-breuninger:master Apr 20, 2026
22 of 23 checks passed
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.

2 participants