opentofu/internal/terraform
Kristin Laemmert 096010600d
terraform: use hcl.MergeBodies instead of configs.MergeBodies for pro… (#29000)
* terraform: use hcl.MergeBodies instead of configs.MergeBodies for provider configuration

Previously, Terraform would return an error if the user supplied provider configuration via interactive input iff the configuration provided on the command line was missing any required attributes - even if those attributes were already set in config.

That error came from configs.MergeBody, which was designed for overriding valid configuration. It expects that the first ("base") body has all required attributes. However in the case of interactive input for provider configuration, it is perfectly valid if either or both bodies are missing required attributes, as long as the final body has all required attributes. hcl.MergeBodies works very similarly to configs.MergeBodies, with a key difference being that it only checks that all required attributes are present after the two bodies are merged.

I've updated the existing test to use interactive input vars and a schema with all required attributes. This test failed before switching from configs.MergeBodies to hcl.MergeBodies.

* add a command package test that shows that we can still have providers with dynamic configuration + required + interactive input merging

This test failed when buildProviderConfig still used configs.MergeBodies instead of hcl.MergeBodies
2021-06-25 08:48:47 -04:00
..
testdata Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_apply2_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_apply_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_components_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_components.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_eval_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_fixtures_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_graph_type.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_import_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_import.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_input_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_input.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_plan2_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_plan_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_refresh_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context_validate_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
context.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_context_builtin_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_context_builtin.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_context_mock.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_context.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_count_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_count.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_for_each_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_for_each.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_provider_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
eval_provider.go terraform: use hcl.MergeBodies instead of configs.MergeBodies for pro… (#29000) 2021-06-25 08:48:47 -04:00
eval_variable.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
evaluate_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
evaluate_valid_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
evaluate_valid.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
evaluate.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_apply.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_destroy_plan.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_eval.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_import.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_plan_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_plan.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder_validate.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_builder.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graph_walk_context.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
graphtype_string.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
marks.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_count_boundary_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_count_boundary.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_data_destroy_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_module_variable.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_output_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_output.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 terraform: use hcl.MergeBodies instead of configs.MergeBodies for pro… (#29000) 2021-06-25 08:48:47 -04:00
node_provider.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_abstract_instance_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
node_resource_abstract_instance.go a noop change with no state has no private data 2021-05-20 09:34:25 -04:00
node_resource_abstract_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
node_resource_abstract.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_apply_instance.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_destroy_deposed.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_destroy.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_plan_destroy.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_plan_instance.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_plan_orphan_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_plan_orphan.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_plan_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_plan.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_validate_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_validate.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_root_variable_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_root_variable.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
reduce_plan.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
resource_provider_mock_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
resource_provider.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
schemas_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
schemas.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
terraform_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_count_boundary.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_destroy_cbd_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_destroy_cbd.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_destroy_edge_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_destroy_edge.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 return error for invalid resource import 2021-05-25 17:13:49 -04:00
transform_import_state.go return error for invalid resource import 2021-05-25 17:13:49 -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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 deposed instances should not be counted as orphans 2021-05-20 09:36:45 -04:00
transform_output.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_provider_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_provider.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_root.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_state.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_transitive_reduction.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
transform_variable.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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 Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
variables.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07: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