opentofu/internal/terraform
James Bardin c872cd6d96 the destroy plan should use correct type
When we plan to destroy an instance, the change recorded should use the
correct type for the resource rather than `DynamicPseudoType`. Most of
the time this is hidden when the change is encoded in the plan, because
any `null` is always encoded to the same value, and when decoded it will
be converted to the schema type. However when apply requires creating a
second plan for an instance's replacement that value is not going to be
encoded, and remains a dynamic value which is sent to the provider.

Most providers won't see that either, as the grpc request also encodes
and decodes the value to conform with the correct schema. The builtin
terraform provider does get the raw cty value though, and when that
dynamic value is returned validation fails when the type does not match.
2023-04-05 10:19:26 -04:00
..
testdata Merge pull request #32876 from hashicorp/jbardin/state-serialize-plan-error 2023-03-28 15:50:59 -04:00
context_apply2_test.go test that module outputs maintain sensitive marks 2023-03-20 14:22:08 -04:00
context_apply_checks_test.go checks: always reference the nested data source from the check graph node (#32946) 2023-04-05 08:48:42 +02:00
context_apply_test.go core: Fix test flake in TestContext2Apply_stop 2023-03-15 13:44:33 -07:00
context_apply.go core: Mark errored plans as errored 2022-12-12 17:17:42 -05:00
context_eval_test.go check console with preconditions 2022-10-19 17:47:53 -04:00
context_eval.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01:00
context_fixtures_test.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_import_test.go unknown evaluation of missing instances in import 2022-10-04 11:07:16 -04:00
context_import.go RemovePlannedResourceInstanceObjects during import 2022-09-25 14:41:53 -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 don't compare plan marks for missing values 2023-03-28 15:55:15 -04:00
context_plan_test.go special handling for legacy ignore_changes = all 2022-09-30 09:19:29 -04:00
context_plan.go Merge pull request #32876 from hashicorp/jbardin/state-serialize-plan-error 2023-03-28 15:50:59 -04:00
context_plugins_test.go build: Use Go 1.19 2022-08-22 10:59:12 -07:00
context_plugins.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_refresh_test.go fix invalid null blocks during refresh 2022-12-21 10:18:26 -05:00
context_refresh.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_test.go initwd: Switch from earlyconfig to configs 2023-03-06 09:14:28 -05:00
context_validate_test.go don't lose warnings from static validation 2022-08-09 16:15:56 -04:00
context_validate.go Combine all plan graphs, including import 2022-06-20 15:40:49 -04:00
context_walk.go core: Propagate check results accurately from plan to apply 2022-08-26 15:47:29 -07:00
context.go backend/local: Periodically persist intermediate state snapshots 2023-02-14 15:17:56 -08:00
diagnostics.go tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
eval_conditions.go Checks: Introduce check blocks into the terraform node and transform graph (#32735) 2023-03-23 16:07:31 +01:00
eval_context_builtin_test.go core: Replace contextComponentFactory with contextPlugins 2021-09-10 14:56:49 -07:00
eval_context_builtin.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01:00
eval_context_mock.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01:00
eval_context.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01: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 Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01: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 Update HCL to handle type mismatches when applying defaults (#32775) 2023-03-09 14:29:58 +01:00
eval_variable.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01:00
evaluate_test.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01: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 Checks: Introduce check blocks into the terraform node and transform graph (#32735) 2023-03-23 16:07:31 +01:00
evaluate_valid.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01:00
evaluate.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01: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 Checks: Introduce check blocks into the terraform node and transform graph (#32735) 2023-03-23 16:07:31 +01:00
graph_builder_eval.go checks must be registered during eval 2022-10-19 17:47:53 -04:00
graph_builder_plan_test.go core: Use DynamicExpand even for root module outputs 2022-07-22 15:25:22 -07:00
graph_builder_plan.go Checks: Introduce check blocks into the terraform node and transform graph (#32735) 2023-03-23 16:07:31 +01: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: Use the new checks package for condition tracking 2022-08-26 15:47:29 -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 fix error message 2022-10-19 14:29:34 -04:00
hook_mock.go backend/local: Periodically persist intermediate state snapshots 2023-02-14 15:17:56 -08:00
hook_stop_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
hook_stop.go backend/local: Periodically persist intermediate state snapshots 2023-02-14 15:17:56 -08:00
hook_test.go backend/local: Periodically persist intermediate state snapshots 2023-02-14 15:17:56 -08:00
hook.go backend/local: Periodically persist intermediate state snapshots 2023-02-14 15:17:56 -08: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 don't compare plan marks for missing values 2023-03-28 15:55:15 -04:00
node_check.go checks: always reference the nested data source from the check graph node (#32946) 2023-04-05 08:48:42 +02: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 core: Simplify our idea of "root node" and require it for DynamicExpand 2022-10-13 14:01:08 -07:00
node_module_expand_test.go evaluate outputs from state 2022-11-28 16:39:55 -05:00
node_module_expand.go evaluate outputs from state 2022-11-28 16:39:55 -05:00
node_module_variable_test.go configs: add ConstraintType to config.Variable 2021-09-13 08:51:32 -04:00
node_module_variable.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01:00
node_output_test.go core: Use the new checks package for condition tracking 2022-08-26 15:47:29 -07:00
node_output.go remove old comments 2023-03-20 14:22:08 -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 build: Use Go 1.19 2022-08-22 10:59:12 -07:00
node_provider.go configure providers during destroy plan 2022-06-01 16:03:27 -04:00
node_resource_abstract_instance_test.go ProvidedBy should return the resolved provider 2022-11-22 09:41:53 -05:00
node_resource_abstract_instance.go the destroy plan should use correct type 2023-04-05 10:19:26 -04:00
node_resource_abstract_test.go ProvidedBy should return the resolved provider 2022-11-22 09:41:53 -05:00
node_resource_abstract.go ProvidedBy should return the resolved provider 2022-11-22 09:41:53 -05:00
node_resource_apply_instance.go use key data from plan method for apply 2022-11-01 16:18:38 -04:00
node_resource_apply_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
node_resource_apply.go core: Simplify our idea of "root node" and require it for DynamicExpand 2022-10-13 14:01:08 -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 avoid re-writing state for noop applies 2022-11-01 16:18:38 -04:00
node_resource_destroy.go avoid re-writing state for noop applies 2022-11-01 16:18:38 -04:00
node_resource_import.go core: Simplify our idea of "root node" and require it for DynamicExpand 2022-10-13 14:01:08 -07: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 Make the pre-destroy refresh a full plan 2022-11-11 14:33:50 -05:00
node_resource_plan_orphan_test.go Fix panic when planning orphaned deposed instances 2023-02-10 15:31:21 -05:00
node_resource_plan_orphan.go Fix panic when planning orphaned deposed instances 2023-02-10 15:31:21 -05:00
node_resource_plan.go Make the pre-destroy refresh a full plan 2022-11-11 14:33:50 -05:00
node_resource_validate_test.go core: Refactor stub repetition data generation 2022-03-10 13:52:48 -05:00
node_resource_validate.go Add support for scoped resources (#32732) 2023-03-10 11:11:10 +01: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 the destroy plan should use correct type 2023-04-05 10:19:26 -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 initwd: Switch from earlyconfig to configs 2023-03-06 09:14:28 -05: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_check.go checks: don't iterate through all the nodes when there is nothing to search for (#32927) 2023-03-28 18:14:27 +02: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 build: Use Go 1.19 2022-08-22 10:59:12 -07:00
transform_destroy_edge_test.go ensure destroy edges from data sources 2022-11-11 14:56:09 -05:00
transform_destroy_edge.go check walkDestroy to help DestroyEdgeTransformer 2022-11-17 13:29:09 -05:00
transform_diff_test.go only add NoOp nodes with conditions 2022-11-01 16:18:38 -04:00
transform_diff.go only add NoOp nodes with conditions 2022-11-01 16:18:38 -04:00
transform_expand.go core: DynamicExpand can return diagnostics 2022-09-26 13:46:25 -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 Do not add orphan nodes for deposed instances 2023-02-10 16:25:11 -05:00
transform_orphan_count.go Do not add orphan nodes for deposed instances 2023-02-10 16:25:11 -05:00
transform_orphan_output.go evaluate outputs from state 2022-11-28 16:39:55 -05: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 Do not add orphan nodes for deposed instances 2023-02-10 16:25:11 -05:00
transform_output.go make naming consistent 2022-10-20 09:36:10 -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 fix log mesage 2022-11-01 16:18:38 -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: Simplify our idea of "root node" and require it for DynamicExpand 2022-10-13 14:01:08 -07:00
transform_root.go core: Simplify our idea of "root node" and require it for DynamicExpand 2022-10-13 14:01:08 -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 core: Use DynamicExpand even for root module outputs 2022-07-22 15:25:22 -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 initwd: Switch from earlyconfig to configs 2023-03-06 09:14:28 -05:00
walkoperation_string.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00