@@ -269,6 +269,14 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op
269269 return generalError ("Failed to retrieve cost estimate" , err )
270270 }
271271
272+ // If the run is canceled or errored, but the cost-estimate still has
273+ // no result, there is nothing further to render.
274+ if ce .Status != tfe .CostEstimateFinished {
275+ if r .Status == tfe .RunCanceled || r .Status == tfe .RunErrored {
276+ return nil
277+ }
278+ }
279+
272280 switch ce .Status {
273281 case tfe .CostEstimateFinished :
274282 delta , err := strconv .ParseFloat (ce .DeltaMonthlyCost , 64 )
@@ -324,6 +332,8 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
324332 b .CLI .Output ("\n ------------------------------------------------------------------------\n " )
325333 }
326334 for i , pc := range r .PolicyChecks {
335+ // Read the policy check logs. This is a blocking call that will only
336+ // return once the policy check is complete.
327337 logs , err := b .client .PolicyChecks .Logs (stopCtx , pc .ID )
328338 if err != nil {
329339 return generalError ("Failed to retrieve policy check logs" , err )
@@ -336,6 +346,15 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
336346 return generalError ("Failed to retrieve policy check" , err )
337347 }
338348
349+ // If the run is canceled or errored, but the policy check still has
350+ // no result, there is nothing further to render.
351+ if r .Status == tfe .RunCanceled || r .Status == tfe .RunErrored {
352+ switch pc .Status {
353+ case tfe .PolicyPending , tfe .PolicyQueued , tfe .PolicyUnreachable :
354+ continue
355+ }
356+ }
357+
339358 var msgPrefix string
340359 switch pc .Scope {
341360 case tfe .PolicyScopeOrganization :
0 commit comments