Skip to content

Fix three bugs in nsxt_edge_transport_node_rtep resource - #2244

Open
ksamoray wants to merge 1 commit into
vmware:branch_3122from
ksamoray:b3122/fix/2083-legacy-rtep-bugs
Open

Fix three bugs in nsxt_edge_transport_node_rtep resource#2244
ksamoray wants to merge 1 commit into
vmware:branch_3122from
ksamoray:b3122/fix/2083-legacy-rtep-bugs

Conversation

@ksamoray

Copy link
Copy Markdown
Contributor

Summary

  • Issue 1 - Import by transport node UUID was broken: Read, Update and Delete all used d.Get("edge_id") to look up the edge, which is empty during terraform import (only d.Id() is populated at that point). Switch all three to d.Id(); add d.Set("edge_id", id) in Read so the attribute is written back to state after an import.
  • Issue 2 - Update sent an empty string pointer for NamedTeamingPolicy whenever the attribute was not set, causing NSX to reject the request with "uplink teaming policy name/s [] not specified". Apply the same non-empty guard that Create already had.
  • Issue 3 - DHCP and no_ipv4 IP assignment types are not supported by the NSX RTEP API (a DHCP request triggers a server-side NPE, code 99). Add getIPAssignmentSchemaForRTEP() which strips those unsupported fields from the shared schema, so an unsupported assignment type is rejected at terraform plan time instead of reaching the API. Update docs accordingly.

Dependency note: getIPAssignmentSchemaForRTEP() calls getIPAssignmentSchema(false) (Optional), flipping this branch's ip_assignment field from its current Required to Optional. This isn't a regression introduced here — a separate, already-queued fix (upstream PR #1966, "Fixing the resource diff issue") adds Computed: true to getIPAssignmentSchema, and Required + Computed is an invalid schema combination, so upstream had already flipped this same field to Optional before this fix landed. When #1966 is ported to this branch, its hunk touching this specific line will be a no-op (already handled here); #1966's Computed: true addition to getIPAssignmentSchema itself is unaffected and still needs to land separately.

Test plan

  • go build ./...
  • go vet ./...
  • gofmt -l . (clean)
  • golangci-lint run ./nsxt/ (0 issues)
  • terrafmt diff ./docs --pattern '*.md' (clean)
  • markdownlint-cli2 docs/**/*.md (0 issues)

Note: master's source PR added mock-based regression tests, which this branch has no framework for; the production fix is otherwise a direct, unmodified port aside from the noted schema-signature simplification.

@ksamoray

ksamoray commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/test-all

@ksamoray
ksamoray force-pushed the b3122/fix/2083-legacy-rtep-bugs branch from 63ff74e to fb9dea8 Compare September 3, 2026 09:49
@ksamoray

ksamoray commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

/test-all

Issue 1 - Import by transport node UUID was broken: Read, Update and
Delete all used d.Get("edge_id") to look up the edge, which is empty
during terraform import (only d.Id() is populated at that point).
Switch all three to d.Id(); add d.Set("edge_id", id) in Read so the
attribute is written back to state after an import.

Issue 2 - Update sent an empty string pointer for NamedTeamingPolicy
whenever the attribute was not set, causing NSX to reject the
request with "uplink teaming policy name/s [] not specified". Apply
the same non-empty guard that Create already had.

Issue 3 - DHCP and no_ipv4 IP assignment types are not supported by
the NSX RTEP API (a DHCP request triggers a server-side NPE, code
99). Add getIPAssignmentSchemaForRTEP() which strips those
unsupported fields from the shared schema, so an unsupported
assignment type is rejected at terraform plan time instead of
reaching the API. Update docs accordingly.

Note: getIPAssignmentSchemaForRTEP() calls getIPAssignmentSchema(false)
(Optional), matching this branch's field as Optional rather than the
Required it currently is. A separate, already-planned fix (PR vmware#1966
upstream) adds Computed:true to getIPAssignmentSchema, and
Required+Computed is an invalid schema combination, so upstream had
already flipped this same field to Optional before this fix landed.
@ksamoray
ksamoray force-pushed the b3122/fix/2083-legacy-rtep-bugs branch from fb9dea8 to 3174118 Compare September 8, 2026 10:51
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.

1 participant