Skip to content

Commit

Permalink
Fix issue IBM-Cloud#1943
Browse files Browse the repository at this point in the history
  • Loading branch information
hkantare committed Oct 7, 2020
1 parent ec2d112 commit 066cc3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions ibm/resource_ibm_tg_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ func resourceIBMTransitGatewayDelete(d *schema.ResourceData, meta interface{}) e
}
response, err := client.DeleteTransitGateway(delOptions)

if err != nil && response.StatusCode != 404 {
log.Printf("Error deleting Transit Gateway: %s", response)
return err
if err != nil {
if response != nil && response.StatusCode == 404 {
return nil
}
return fmt.Errorf("Error deleting Transit Gateway (%s): %s\n%s", ID, err, response)
}
_, err = isWaitForTransitGatewayDeleted(client, ID, d.Timeout(schema.TimeoutDelete))
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions ibm/resource_ibm_tg_gateway_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,11 @@ func resourceIBMTransitGatewayConnectionDelete(d *schema.ResourceData, meta inte
deleteTransitGatewayConnectionOptions.SetTransitGatewayID(gatewayId)
response, err := client.DeleteTransitGatewayConnection(deleteTransitGatewayConnectionOptions)

if err != nil && response.StatusCode != 404 {
log.Printf("Error deleting Transit Gateway Connection: %s", response)
return err
if err != nil {
if response != nil && response.StatusCode == 404 {
return nil
}
return fmt.Errorf("Error deleting Transit Gateway Connection(%s): %s\n%s", ID, err, response)
}
_, err = isWaitForTransitGatewayConnectionDeleted(client, d.Id(), d.Timeout(schema.TimeoutCreate))

Expand Down

0 comments on commit 066cc3b

Please sign in to comment.