Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't persist diff to the state when an update fails #857

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions helm/resource_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,32 +596,38 @@ func resourceReleaseUpdate(ctx context.Context, d *schema.ResourceData, meta int
n := d.Get("namespace").(string)
actionConfig, err := m.GetHelmConfiguration(n)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
}
err = OCIRegistryLogin(actionConfig, d)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
}
client := action.NewUpgrade(actionConfig)

cpo, chartName, err := chartPathOptions(d, m, &client.ChartPathOptions)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
}

c, path, err := getChart(d, m, chartName, cpo)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
}

// check and update the chart's dependencies if needed
updated, err := checkChartDependencies(d, c, path, m)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
} else if updated {
// load the chart again if its dependencies have been updated
c, err = loader.Load(path)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
}
}
Expand Down Expand Up @@ -649,6 +655,7 @@ func resourceReleaseUpdate(ctx context.Context, d *schema.ResourceData, meta int
pr, err := postrender.NewExec(cmd)

if err != nil {
d.Partial(true)
return diag.FromErr(err)
}

Expand All @@ -657,12 +664,14 @@ func resourceReleaseUpdate(ctx context.Context, d *schema.ResourceData, meta int

values, err := getValues(d)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
}

name := d.Get("name").(string)
r, err := client.Run(name, c, values)
if err != nil {
d.Partial(true)
return diag.FromErr(err)
}

Expand Down