-
Notifications
You must be signed in to change notification settings - Fork 884
feat: show Terraform error details #6643
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, but I couldn't really see how/if the existing internal formatting is used at all any longer, in which case we may lose error detail?
@@ -509,7 +512,7 @@ func convertTerraformLogLevel(logLevel string, sink logSink) proto.LogLevel { | |||
return proto.LogLevel_DEBUG | |||
case "info": | |||
return proto.LogLevel_INFO | |||
case "warn": | |||
case "warn", "warning": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spotted in the original Terraform code that it has references to "warning". Maybe some Terraform versions or plugins use a different label?
for _, value := range values { | ||
_, _ = fmt.Fprintf(buf, " │ %s %s\n", value.Traversal, value.Statement) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed like the original (internal) code is slightly more complex, do we lose any details in error output or are they surfaced some other way? It looked like function calls/args were handled in internal, but not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as these are not exposed by terraform-json
. I think that we can live without those until any user requests them.
Resolves: #6453
This PR enables Terraform diagnostics details in the site view and CLI. Unfortunately, the original formatter is in the
internal
package, so I had to implement a similar one.