opentofu/internal/command/views/json
Martin Atkins 90ea7b0bc5 tfdiags: Treat unknown-related or sensitive-related messages differently
By observing the sorts of questions people ask in the community, and the
ways they ask them, we've inferred that various different people have been
confused by Terraform reporting that a value won't be known until apply
or that a value is sensitive as part of an error message when that message
doesn't actually relate to the known-ness and sensitivity of any value.

Quite reasonably, someone who sees Terraform discussing an unfamiliar
concept like unknown values can assume that it must be somehow relevant to
the problem being discussed, and so in that sense Terraform's current
error messages are giving "too much information": information that isn't
actually helpful in understanding the problem being described, and in the
worst case is a distraction from understanding the problem being described.

With that in mind then, here we introduce an explicit annotation on
diagnostic objects that are directly talking about unknown values or
sensitive values, and then the diagnostic renderer will react to that to
avoid using the terminology "known only after apply" or "sensitive" in the
generated diagnostic annotations unless we're rendering a message that is
explicitly related to one of those topics.

This ends up being a bit of a cross-cutting concern because the code that
generates these diagnostics and the code that renders them are in separate
packages and are not directly aware of each other. With that in mind, the
logic for actually deciding for a particular diagnostic whether it's
flagged in one of these special ways lives inside the tfdiags package as
an intermediation point, which both the diagnostic generator (in the core
package) and the diagnostic renderer can both depend on.
2022-06-23 13:52:23 -07:00
..
testdata/diagnostic tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
change_summary.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
change.go core: Report reason for deferring data read until apply 2022-05-09 11:12:47 -07:00
diagnostic_test.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
diagnostic.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
function_test.go command/format: Include function call information in diagnostics 2022-06-23 13:52:23 -07:00
function.go command/format: Include function call information in diagnostics 2022-06-23 13:52:23 -07:00
hook.go json-output: Add change reasons to explain deletes 2021-09-24 13:17:49 -04:00
message_types.go json-output: Add resource drift to machine readable UI 2021-06-30 14:57:55 -04:00
output_test.go de-linting 2021-09-01 11:36:21 -04:00
output.go json-output: Add output changes to plan logs 2021-08-05 15:32:26 -04:00
resource_addr.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00