Skip to content

Commit

Permalink
Enable "helm uninstall --ignore-not-found" equivalent behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sbocinec committed Sep 17, 2024
1 parent b9dcb2b commit 6047167
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions helm/resource_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var defaultAttributes = map[string]interface{}{
"create_namespace": false,
"lint": false,
"pass_credentials": false,
"ignore_not_found": false,
}

func resourceRelease() *schema.Resource {
Expand Down Expand Up @@ -451,6 +452,12 @@ func resourceRelease() *schema.Resource {
},
},
},
"ignore_not_found": {
Type: schema.TypeBool,
Optional: true,
Default: defaultAttributes["ignore_not_found"],
Description: "If true, the provider will treat `release not found` as a successful uninstall during the resource destroy. Defaults to `false`.",
},
},
SchemaVersion: 1,
StateUpgraders: []schema.StateUpgrader{
Expand Down Expand Up @@ -863,6 +870,7 @@ func resourceReleaseDelete(ctx context.Context, d *schema.ResourceData, meta int
uninstall.Wait = d.Get("wait").(bool)
uninstall.DisableHooks = d.Get("disable_webhooks").(bool)
uninstall.Timeout = time.Duration(d.Get("timeout").(int)) * time.Second
uninstall.IgnoreNotFound = d.Get("ignore_not_found").(bool)

res, err := uninstall.Run(name)
if err != nil {
Expand Down

0 comments on commit 6047167

Please sign in to comment.