Skip to content

Commit

Permalink
added 404 response code check on delete call (#4512) (#3018)
Browse files Browse the repository at this point in the history
* added 404 response code check on delete call

* log statement added and error check corrected

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Mar 2, 2021
1 parent 894d7b8 commit ef373f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .changelog/4512.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
container : fixed container cluster not removed from the state when received 404 error on delete call for the resource `google_container_clsuter`

```
4 changes: 4 additions & 0 deletions google-beta/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2551,6 +2551,10 @@ func resourceContainerClusterDelete(d *schema.ResourceData, meta interface{}) er
clusterName := d.Get("name").(string)

if _, err := containerClusterAwaitRestingState(config, project, location, clusterName, userAgent, d.Timeout(schema.TimeoutDelete)); err != nil {
if isGoogleApiErrorWithCode(err, 404) {
log.Printf("[INFO] GKE cluster %s doesn't exist to delete", d.Id())
return nil
}
return err
}

Expand Down

0 comments on commit ef373f9

Please sign in to comment.