|
|
|
|
@ -269,6 +269,14 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op
|
|
|
|
|
return generalError("Failed to retrieve cost estimate", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the run is canceled or errored, but the cost-estimate still has
|
|
|
|
|
// no result, there is nothing further to render.
|
|
|
|
|
if ce.Status != tfe.CostEstimateFinished {
|
|
|
|
|
if r.Status == tfe.RunCanceled || r.Status == tfe.RunErrored {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch ce.Status {
|
|
|
|
|
case tfe.CostEstimateFinished:
|
|
|
|
|
delta, err := strconv.ParseFloat(ce.DeltaMonthlyCost, 64)
|
|
|
|
|
@ -324,18 +332,27 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
|
|
|
|
|
b.CLI.Output("\n------------------------------------------------------------------------\n")
|
|
|
|
|
}
|
|
|
|
|
for i, pc := range r.PolicyChecks {
|
|
|
|
|
logs, err := b.client.PolicyChecks.Logs(stopCtx, pc.ID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return generalError("Failed to retrieve policy check logs", err)
|
|
|
|
|
}
|
|
|
|
|
reader := bufio.NewReaderSize(logs, 64*1024)
|
|
|
|
|
|
|
|
|
|
// Retrieve the policy check to get its current status.
|
|
|
|
|
pc, err := b.client.PolicyChecks.Read(stopCtx, pc.ID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return generalError("Failed to retrieve policy check", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the run is canceled or errored, but the policy check still has
|
|
|
|
|
// no result, there is nothing further to render.
|
|
|
|
|
if r.Status == tfe.RunCanceled || r.Status == tfe.RunErrored {
|
|
|
|
|
switch pc.Status {
|
|
|
|
|
case tfe.PolicyPending, tfe.PolicyQueued, tfe.PolicyUnreachable:
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logs, err := b.client.PolicyChecks.Logs(stopCtx, pc.ID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return generalError("Failed to retrieve policy check logs", err)
|
|
|
|
|
}
|
|
|
|
|
reader := bufio.NewReaderSize(logs, 64*1024)
|
|
|
|
|
|
|
|
|
|
var msgPrefix string
|
|
|
|
|
switch pc.Scope {
|
|
|
|
|
case tfe.PolicyScopeOrganization:
|
|
|
|
|
|