Skip to content

Commit 50f2018

Browse files
committed
Move changelog entry to backport section, added an explanatory comment
1 parent 0ede1f9 commit 50f2018

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
File renamed without changes.

internal/cloud/backend_apply.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ func (b *Cloud) opApply(stopCtx, cancelCtx context.Context, op *backendrun.Opera
8383

8484
var r *tfe.Run
8585
var err error
86-
cp, hasSavePlanFile := op.PlanFile.Cloud()
87-
if hasSavePlanFile {
86+
cp, hasSavedPlanFile := op.PlanFile.Cloud()
87+
if hasSavedPlanFile {
8888
log.Printf("[TRACE] Loading saved cloud plan for apply")
8989
// Check hostname first, for a more actionable error than a generic 404 later
9090
if cp.Hostname != b.Hostname {
@@ -182,7 +182,9 @@ func (b *Cloud) opApply(stopCtx, cancelCtx context.Context, op *backendrun.Opera
182182
}
183183

184184
// Do the apply!
185-
if (!op.AutoApprove || hasSavePlanFile) && err != errRunApproved {
185+
// If we have a saved plan file, we proceed to apply the run without confirmation
186+
// regardless of the value of AutoApprove.
187+
if (!op.AutoApprove || hasSavedPlanFile) && err != errRunApproved {
186188
if err = b.client.Runs.Apply(stopCtx, r.ID, tfe.RunApplyOptions{}); err != nil {
187189
return r, b.generalError("Failed to approve the apply command", err)
188190
}

0 commit comments

Comments
 (0)