Cost Estimation CLI output unnecessary#27735
Cost Estimation CLI output unnecessary#27735omarismail merged 2 commits intohashicorp:masterfrom omarismail:cost-estimation-output
Conversation
| } | ||
|
|
||
| if b.CLI != nil { | ||
| b.CLI.Output("\n------------------------------------------------------------------------\n") |
There was a problem hiding this comment.
I moved the starting output ---- here because on line 274 we check to ensure that there are no errors/cancellations.
There was a problem hiding this comment.
Does this mean that we might see a couple of lines of ----s if we hit CostEstimatePending, tfe.CostEstimateQueued? I know this kind of procedural flow makes it hard to do this correctly, but I'm thinking we shouldn't show this separator every iteration
| deltaRepr := strings.Replace(ce.DeltaMonthlyCost, "-", "", 1) | ||
|
|
||
| if b.CLI != nil { | ||
| b.CLI.Output(b.Colorize().Color(msgPrefix + ":\n")) |
There was a problem hiding this comment.
I moved the specific msgPrefix part here and the other lines below because other cases have a different prefex mesage, and there wasn't a clean way to not duplicate.
Codecov Report
|
mwhooker
left a comment
There was a problem hiding this comment.
Thanks for fixing this, @omarismail! I like the changes, but I think figuring out a way to avoid sending the horizontal-rule every retry would be preferable. Unfortunately you might have to copy & paste the same way as you did with msgPrefix.
I changed the first horizontal rule to only run on the first attempt. |
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Problem
When an error occurs during
terraform apply, the "Cost Estimation" output appears, even though it shouldn't.See Screenshot
Solution
There is nothing wrong with the specific conditions in the remote backend for cost estimations. Rather, the
CLI.Outputshould appear further below depending on theStatusreturned from theapi/v2/cost-estimationendpoint in the remote backend.