Skip to content

Commit

Permalink
Allow deleting a non-existing VPC
Browse files Browse the repository at this point in the history
  • Loading branch information
odaira authored and hkantare committed Mar 26, 2020
1 parent 298ebe0 commit 214996e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ibm/resource_ibm_is_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ func resourceIBMISVPCDelete(d *schema.ResourceData, meta interface{}) error {
vpcC := network.NewVPCClient(sess)
err = vpcC.Delete(d.Id())
if err != nil {
iserror, ok := err.(iserrors.RiaasError)
if ok {
if len(iserror.Payload.Errors) == 1 &&
iserror.Payload.Errors[0].Code == "not_found" {
return nil
}
}
return err
}

Expand Down

0 comments on commit 214996e

Please sign in to comment.