Skip to content

Commit

Permalink
Check httpResponse when destroying vpn_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-toa committed Sep 4, 2024
1 parent d1433de commit e12ca5b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions outscale/resource_outscale_vpn_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,16 @@ func vpnConnectionRefreshFunc(conn *oscgo.APIClient, vpnConnectionID *string) re
}
resp, httpResp, err := conn.VpnConnectionApi.ReadVpnConnections(context.Background()).ReadVpnConnectionsRequest(filter).Execute()
if err != nil {
switch {
case httpResp.StatusCode == http.StatusServiceUnavailable:
return nil, "pending", nil
case httpResp.StatusCode == http.StatusNotFound:
return nil, "deleted", nil
default:
if httpResp != nil {
switch {
case httpResp.StatusCode == http.StatusServiceUnavailable:
return nil, "pending", nil
case httpResp.StatusCode == http.StatusNotFound:
return nil, "deleted", nil
default:
return nil, "failed", fmt.Errorf("Error on vpnConnectionRefresh: %s", err)
}
} else {
return nil, "failed", fmt.Errorf("Error on vpnConnectionRefresh: %s", err)
}
}
Expand Down

0 comments on commit e12ca5b

Please sign in to comment.