Fix nsxt_edge_transport_node perpetual drift - #2235
Open
ksamoray wants to merge 1 commit into
Open
Conversation
ksamoray
force-pushed
the
b3122/fix/3689817
branch
from
August 20, 2026 14:36
3129deb to
17d5b1f
Compare
Contributor
Author
|
/test-all |
ksamoray
force-pushed
the
b3122/fix/3689817
branch
from
September 3, 2026 09:49
17d5b1f to
3f3ec47
Compare
Contributor
Author
|
/test-all |
The NSX MP API returns bare realization UUIDs for uplink_profile,
vtep_ha_profile, host_switch_profile and transport_zone, while
configuration uses policy paths. This caused a perpetual diff after
every apply. Additionally, NSX silently injects a default
audit_username ("audit") that was not present in configuration.
Fix strategy:
- Enforce policy paths via ValidateFunc on uplink_profile,
vtep_ha_profile, host_switch_profile elements and transport_zone.
This makes the prior state value for these fields a reliable
policy path.
- In resourceNsxtEdgeTransportNodeRead, capture the prior state
before setHostSwitchSpecInSchema overwrites it with API UUIDs,
then restore any policy-path values via
etNodeNormalizeHostSwitchesInState. Because inputs are validated
to be policy paths no API lookup is needed: isPolicyPath(priorVal)
is sufficient to decide what to keep.
- Mark audit_username as Optional+Computed so Terraform accepts the
NSX default value without showing a diff when the user omits the
field.
ksamoray
force-pushed
the
b3122/fix/3689817
branch
from
September 8, 2026 10:46
3f3ec47 to
d5f8df5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uplink_profile,vtep_ha_profile,host_switch_profileandtransport_zone, while configuration uses policy paths. This caused a perpetual diff after every apply.audit_username("audit") that was not present in configuration, causing a perpetual diff there too.ValidateFunconuplink_profile,vtep_ha_profile,host_switch_profileelements andtransport_zone, making the prior state value for these fields a reliable policy path.resourceNsxtEdgeTransportNodeRead, capture the prior state beforesetHostSwitchSpecInSchemaoverwrites it with API UUIDs, then restore any policy-path values viaetNodeNormalizeHostSwitchesInState.audit_usernameasOptional+Computedso Terraform accepts the NSX default value without showing a diff when the user omits the field.This is a hand-port of the equivalent fix on master, adapted for this release branch (master's version also reverts an unported earlier fix attempt; this PR implements the final, corrected behavior directly against branch_3122's current schema).
Test plan
go build ./...go vet ./...gofmt -l .(clean)golangci-lint run ./nsxt/(0 issues)No acceptance/unit test coverage is added, matching the corresponding fix on master, which also shipped without one.