Skip to content

Commit

Permalink
Make Deleting PVs Idempotent (#1935)
Browse files Browse the repository at this point in the history
* Make Deleting PVs Idempotent
  • Loading branch information
sherifabdlnaby authored Jan 10, 2023
1 parent 7e1ac6b commit e5f0f42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changelog/1935.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
`resource/kubernetes_persistent_volume`: add additional validation on the delete operation to make it idempotent
```

```release-note:enhancement
`resource/kubernetes_persistent_volume_v1`: add additional validation on the delete operation to make it idempotent
```
3 changes: 3 additions & 0 deletions kubernetes/resource_kubernetes_persistent_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ func resourceKubernetesPersistentVolumeDelete(ctx context.Context, d *schema.Res
log.Printf("[INFO] Deleting persistent volume: %#v", name)
err = conn.CoreV1().PersistentVolumes().Delete(ctx, name, metav1.DeleteOptions{})
if err != nil {
if statusErr, ok := err.(*k8serrors.StatusError); ok && k8serrors.IsNotFound(statusErr) {
return nil
}
return diag.FromErr(err)
}

Expand Down

0 comments on commit e5f0f42

Please sign in to comment.