Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate repetitive warning messages #23425

Merged
merged 2 commits into from
Nov 19, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
command: Don't show more than two of the same warning
Some of our warnings are produced in response to particular configuration
constructs which might appear many times across a Terraform configuration.
To avoid the warning output dwarfing all of the other output, we'll use
ConsolidateWarnings to limit each distinct warning summary to appear at
most twice, and annotate the final one in the sequence with an additional
paragraph noting that some number of them have been hidden.

This is intended as a compromise to ensure that these warnings are still
seen and noted but to help ensure that we won't produce so many of them
as to distract from other output that appears alongside them.

This applies only to warnings relating to specific configuration ranges;
errors will continue to be shown individually, and sourceless warnings
(which are rare in Terraform today) will likewise remain ungrouped because
they are less likely to be repeating the same statement about different
instances of the same problem throughout the configuration.
apparentlymart committed Nov 19, 2019

Verified

This commit was signed with the committer’s verified signature.
Midnightific Griffin
commit 305f547d6decbdc8e9fefe206d9bcabe241cbafa
3 changes: 3 additions & 0 deletions command/meta.go
Original file line number Diff line number Diff line change
@@ -480,6 +480,9 @@ func (m *Meta) showDiagnostics(vals ...interface{}) {
diags = diags.Append(vals...)
diags.Sort()

// Since warning messages are generally competing
diags = diags.ConsolidateWarnings()

for _, diag := range diags {
// TODO: Actually measure the terminal width and pass it here.
// For now, we don't have easy access to the writer that