Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .changelog/1713.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
`resource/helm_release`: Fix "inconsistent result after apply" error by moving recomputeMetadata function call
```
13 changes: 8 additions & 5 deletions helm/resource_helm_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -1971,11 +1971,6 @@ func (r *HelmRelease) ModifyPlan(ctx context.Context, req resource.ModifyPlanReq
// Always set desired state to DEPLOYED
plan.Status = types.StringValue(release.StatusDeployed.String())

if recomputeMetadata(plan, state) {
tflog.Debug(ctx, fmt.Sprintf("%s Metadata has changes, setting to unknown", logID))
plan.Metadata = types.ObjectUnknown(metadataAttrTypes())
}

if !useChartVersion(plan.Chart.ValueString(), plan.Repository.ValueString()) {
// Check if version has changed
if state != nil && !plan.Version.Equal(state.Version) {
Expand Down Expand Up @@ -2275,6 +2270,11 @@ You should update the version in your configuration to %[2]q, or remove the vers
}
}

if recomputeMetadata(plan, state) {
tflog.Debug(ctx, fmt.Sprintf("%s Metadata has changes, setting to unknown", logID))
plan.Metadata = types.ObjectUnknown(metadataAttrTypes())
}

resp.Plan.Set(ctx, &plan)
}

Expand All @@ -2291,6 +2291,9 @@ func recomputeMetadata(plan HelmReleaseModel, state *HelmReleaseModel) bool {
if !plan.Repository.Equal(state.Repository) {
return true
}
if !plan.Version.Equal(state.Version) {
return true
}
if !plan.Values.Equal(state.Values) {
return true
}
Expand Down
Loading