[AV-129893] Revert: Enhance network peer error handling and state management"#621
Conversation
…agement …" This reverts commit 8570973.
|
🚨 PR title "Revert "AV-129893 Enhance network peer error handling and state management"" does not match the required format. |
|
No PR template selections were detected. Please make sure to fill out the PR template properly by selecting the appropriate checkboxes. |
There was a problem hiding this comment.
Pull request overview
This pull request reverts PR #580, rolling back recent changes that enhanced network peer error handling and state management in the provider. The revert primarily affects how network peer responses are interpreted (especially around optional status/providerConfig fields) and how the resource behaves during create/read refresh.
Changes:
- Reverts nil/empty handling for
providerConfigandstatus.reasoning/statewhen morphing API responses into Terraform state. - Reverts “best-effort” provider type inference and related state refresh behavior in the network peer resource.
- Removes unit tests that covered nil/null
providerConfigand nilreasoningscenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| internal/schema/network_peer.go | Reverted schema/state morphing logic; reintroduces unsafe dereferences and stricter providerConfig parsing. |
| internal/schema/network_peer_test.go | Removes tests that previously validated nil/null providerConfig and nil reasoning handling. |
| internal/resources/network_peer.go | Reverts resource-level error handling and provider-type inference; introduces issues with provider-type detection and error wrapping. |
Comments suppressed due to low confidence (1)
internal/schema/network_peer.go:223
- Potential nil-pointer dereference: this block checks
networkPeer.Status.State != nilbut then unconditionally dereferencesnetworkPeer.Status.Reasoning. The API type uses pointers for both fields, soReasoningcan be nil and will panic during state refresh.
if networkPeer.Status.State != nil {
state := *networkPeer.Status.State
reasoning := *networkPeer.Status.Reasoning
status := PeeringStatus{
State: types.StringValue(state),
Reasoning: types.StringValue(reasoning),
}
Reverts #580