opentofu/internal/terraform
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 update test fixtures for better imports 2022-06-20 15:40:49 -04:00
context_apply2_test.go configure providers during destroy plan 2022-06-01 16:03:27 -04:00
context_apply_test.go Conclude module variable optional attrs experiment 2022-06-13 12:27:21 -04:00
context_apply.go core: Store condition block results in plan 2022-04-04 15:36:29 -04:00
context_eval_test.go core and backend: remove redundant handling of default variable values 2022-01-10 12:26:54 -08:00
context_eval.go core and backend: remove redundant handling of default variable values 2022-01-10 12:26:54 -08:00
context_fixtures_test.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_import_test.go add required attr to import test 2022-06-22 13:30:44 -04:00
context_import.go remove unused field and extra assignment 2022-06-23 11:47:01 -04:00
context_input_test.go wrap multiple provider creations into a factory fn 2021-10-12 17:47:50 -04:00
context_input.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_plan2_test.go core: Defer on transitive dependencies for data resources with conditions 2022-05-11 11:01:38 -07:00
context_plan_test.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
context_plan.go Merge pull request #31283 from hashicorp/jbardin/plan-import 2022-06-23 13:26:59 -04:00
context_plugins_test.go core: Replace contextComponentFactory with contextPlugins 2021-09-10 14:56:49 -07:00
context_plugins.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_refresh_test.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_refresh.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
context_validate_test.go Conclude preconditions/postconditions experiment 2022-04-04 15:54:40 -04:00
context_validate.go Combine all plan graphs, including import 2022-06-20 15:40:49 -04:00
context_walk.go Combine all plan graphs, including import 2022-06-20 15:40:49 -04:00
context.go insert panic handlers 2021-10-28 11:51:39 -04:00
diagnostics.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
eval_conditions.go core: Store condition block results in plan 2022-04-04 15:36:29 -04:00
eval_context_builtin_test.go core: Replace contextComponentFactory with contextPlugins 2021-09-10 14:56:49 -07:00
eval_context_builtin.go limit replace_triggered_by to same module instance 2022-04-20 09:17:10 -04:00
eval_context_mock.go Use the EvalContext to lookup trigger changes 2022-04-20 09:17:10 -04:00
eval_context.go Use the EvalContext to lookup trigger changes 2022-04-20 09:17:10 -04:00
eval_count_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
eval_count.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
eval_for_each_test.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
eval_for_each.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
eval_provider_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_provider.go core: EvalContextBuiltin no longer has a "Schemas" 2021-09-10 14:56:49 -07:00
eval_variable_test.go Merge pull request #30552 from gbataille/29156_do_not_log_sensitive_values 2022-05-30 10:40:51 -04:00
eval_variable.go core: Apply type defaults to module variables 2022-05-31 12:11:15 -04:00
evaluate_test.go Merge pull request #29559 from hashicorp/jbardin/optional-attrs 2021-09-13 08:58:11 -04:00
evaluate_triggers_test.go evaluate replace_triggered_by expressions 2022-04-20 09:17:10 -04:00
evaluate_triggers.go evaluate replace_triggered_by expressions 2022-04-20 09:17:10 -04:00
evaluate_valid_test.go core: Graph walk loads plugin schemas opportunistically 2021-09-10 14:56:49 -07:00
evaluate_valid.go core: Document postconditions as valid use of self 2022-01-31 14:34:35 -05:00
evaluate.go Fix problems caught by staticcheck v0.3.0 2022-04-04 08:12:44 -07:00
execute.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
features.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_apply_test.go core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary 2021-09-20 09:06:22 -07:00
graph_builder_apply.go remove unused fields from DestroyEdgeTransformer 2022-05-27 10:54:58 -04:00
graph_builder_eval.go always validate all graphs 2022-03-11 10:20:50 -05:00
graph_builder_plan_test.go Combine all plan graphs, including import 2022-06-20 15:40:49 -04:00
graph_builder_plan.go remove unused field and extra assignment 2022-06-23 11:47:01 -04:00
graph_builder_test.go always validate all graphs 2022-03-11 10:20:50 -05:00
graph_builder.go always validate all graphs 2022-03-11 10:20:50 -05:00
graph_dot_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_dot.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_interface_subgraph.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_test.go de-linting 2021-09-01 11:36:21 -04:00
graph_walk_context.go core: Store condition block results in plan 2022-04-04 15:36:29 -04:00
graph_walk_operation.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_walk_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_walk.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph.go insert panic handlers 2021-10-28 11:51:39 -04:00
hook_mock.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
hook_stop_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
hook_stop.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
hook_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
hook.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
instance_expanders.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
marks_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
marks.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_data_destroy_test.go command/workspace_delete: Allow deleting a workspace with empty husks 2021-10-13 13:54:11 -07:00
node_data_destroy.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_local_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_local.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_module_expand_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_module_expand.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_module_variable_test.go configs: add ConstraintType to config.Variable 2021-09-13 08:51:32 -04:00
node_module_variable.go remove synthetic default expression for variables 2022-01-10 16:22:33 -05:00
node_output_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
node_output.go prevent unsynchronized output changes access 2022-04-20 14:45:58 -04:00
node_provider_abstract.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_provider_eval.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_provider_test.go Merge pull request #29039 from hashicorp/jbardin/sensitive 2021-06-25 17:11:59 -04:00
node_provider.go configure providers during destroy plan 2022-06-01 16:03:27 -04:00
node_resource_abstract_instance_test.go core: Fix schema loading for deleted resources 2021-11-24 15:23:20 -05:00
node_resource_abstract_instance.go add unknown paths to diags for debugging 2022-05-23 13:28:30 -04:00
node_resource_abstract_test.go have mockProvider always check it was configured 2022-06-01 16:16:20 -04:00
node_resource_abstract.go Combine all plan graphs, including import 2022-06-20 15:40:49 -04:00
node_resource_apply_instance.go remove redundant readResourceInstanceState 2022-04-11 10:12:44 -04:00
node_resource_apply_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_apply.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_destroy_deposed_test.go fixup tests for MockProvider changes 2021-10-08 08:42:06 -04:00
node_resource_destroy_deposed.go core: Check pre- and postconditions for resources and output values 2022-01-31 14:02:53 -05:00
node_resource_destroy.go core: Check pre- and postconditions for resources and output values 2022-01-31 14:02:53 -05:00
node_resource_import.go remove import transformer 2022-06-20 16:11:02 -04:00
node_resource_plan_destroy.go remove data sources from state read and upgrade 2022-04-11 11:55:53 -04:00
node_resource_plan_instance.go copy dependency values when sorting 2022-06-14 11:09:27 -04:00
node_resource_plan_orphan_test.go fixup tests for MockProvider changes 2021-10-08 08:42:06 -04:00
node_resource_plan_orphan.go instances: Non-existing module instance has no resource instances 2021-12-13 10:03:50 -05:00
node_resource_plan_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_plan.go Merge pull request #31283 from hashicorp/jbardin/plan-import 2022-06-23 13:26:59 -04:00
node_resource_validate_test.go core: Refactor stub repetition data generation 2022-03-10 13:52:48 -05:00
node_resource_validate.go communicator/ssh: Add support SSH over HTTP Proxy (#30274) 2022-04-27 16:59:17 -04:00
node_root_variable_test.go core: Check rule error message expressions 2022-03-04 15:35:39 -05:00
node_root_variable.go core: More accurate error message for invalid variable values 2022-01-10 12:26:54 -08:00
node_value.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
phasestate_string.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
provider_mock.go have mockProvider always check it was configured 2022-06-01 16:16:20 -04:00
provisioner_mock_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
provisioner_mock.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
reduce_plan_test.go test for null map and fix lost map marks 2021-11-11 10:44:39 -05:00
reduce_plan.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
resource_provider_mock_test.go de-linting 2021-09-01 11:36:21 -04:00
schemas_test.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
schemas.go providers: A type for all schemas for a particular provider 2022-03-04 15:51:36 -05:00
terraform_test.go Experiments supported only in alpha/dev builds 2022-06-17 14:46:07 -07:00
transform_attach_config_provider_meta.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_attach_config_provider.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_attach_config_resource.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_attach_schema.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_attach_state.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_config_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_config.go Combine all plan graphs, including import 2022-06-20 15:40:49 -04:00
transform_destroy_cbd_test.go make sure CBD test graphs are valid 2022-03-11 10:20:50 -05:00
transform_destroy_cbd.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_destroy_edge_test.go remove unused fields from DestroyEdgeTransformer 2022-05-27 10:54:58 -04:00
transform_destroy_edge.go minor cleanup from review 2022-06-01 15:29:59 -04:00
transform_diff_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_diff.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_expand.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_import_state_test.go fixup tests for MockProvider changes 2021-10-08 08:42:06 -04:00
transform_local.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_module_expansion.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_module_variable_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_module_variable.go remove synthetic default expression for variables 2022-01-10 16:22:33 -05:00
transform_orphan_count_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_orphan_count.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_orphan_output.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_orphan_resource_test.go deposed instances should not be counted as orphans 2021-05-20 09:36:45 -04:00
transform_orphan_resource.go minor cleanup from review 2022-06-01 15:29:59 -04:00
transform_output.go minor cleanup from review 2022-06-01 15:29:59 -04:00
transform_provider_test.go Merge pull request #31283 from hashicorp/jbardin/plan-import 2022-06-23 13:26:59 -04:00
transform_provider.go skip already added provider nodes 2022-06-10 10:37:58 -04:00
transform_provisioner.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_reference_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_reference.go do not connect references _to_ destroyers either 2022-05-27 10:50:01 -04:00
transform_removed_modules.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_resource_count.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_root_test.go core: Provider transformers don't use the set of all available providers 2021-09-10 14:56:49 -07:00
transform_root.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_state.go command/workspace_delete: Allow deleting a workspace with empty husks 2021-10-13 13:54:11 -07:00
transform_targets_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_targets.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_transitive_reduction_test.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_transitive_reduction.go Update comment for this transformer 2022-03-22 17:17:56 -06:00
transform_variable.go core: Handle root and child module input variables consistently 2022-01-10 12:26:54 -08:00
transform_vertex_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_vertex.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_input_mock.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_input_prefix_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_input_prefix.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_input.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_output_callback_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_output_callback.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_output_mock_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_output_mock.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_output_provisioner_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_output_provisioner.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_output.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
update_state_hook_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
update_state_hook.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
upgrade_resource_state_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
upgrade_resource_state.go remove data sources from state read and upgrade 2022-04-11 11:55:53 -04:00
util_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
util.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
validate_selfref_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
validate_selfref.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
valuesourcetype_string.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
variables_test.go core and backend: remove redundant handling of default variable values 2022-01-10 12:26:54 -08:00
variables.go core: More accurate error message for invalid variable values 2022-01-10 12:26:54 -08:00
version_required.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
walkoperation_string.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00