terraform/internal/terraform
Martin Atkins bee7403f3e command/workspace_delete: Allow deleting a workspace with empty husks
Previously we would reject attempts to delete a workspace if its state
contained any resources at all, even if none of the resources had any
resource instance objects associated with it.

Nowadays there isn't any situation where the normal Terraform workflow
will leave behind resource husks, and so this isn't as problematic as it
might've been in the v0.12 era, but nonetheless what we actually care
about for this check is whether there might be any remote objects that
this state is tracking, and for that it's more precise to look for
non-nil resource instance objects, rather than whole resources.

This also includes some adjustments to our error messaging to give more
information about the problem and to use terminology more consistent with
how we currently talk about this situation in our documentation and
elsewhere in the UI.

We were also using the old State.HasResources method as part of some of
our tests. I considered preserving it to avoid changing the behavior of
those tests, but the new check seemed close enough to the intent of those
tests that it wasn't worth maintaining this method that wouldn't be used
in any main code anymore. I've therefore updated those tests to use
the new HasResourceInstanceObjects method instead.
2021-10-13 13:54:11 -07:00
..
testdata
context.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_apply.go core: Graph walk loads plugin schemas opportunistically 2021-09-10 14:56:49 -07:00
context_apply2_test.go skip refreshing deposed during destroy plan 2021-10-07 16:51:48 -04:00
context_apply_test.go command/workspace_delete: Allow deleting a workspace with empty husks 2021-10-13 13:54:11 -07:00
context_eval.go core: Graph walk loads plugin schemas opportunistically 2021-09-10 14:56:49 -07:00
context_eval_test.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_fixtures_test.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_import.go core: Graph walk loads plugin schemas opportunistically 2021-09-10 14:56:49 -07:00
context_import_test.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_input.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_input_test.go wrap multiple provider creations into a factory fn 2021-10-12 17:47:50 -04:00
context_plan.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_plan2_test.go fixup tests for MockProvider changes 2021-10-08 08:42:06 -04:00
context_plan_test.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_plugins.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_plugins_test.go core: Replace contextComponentFactory with contextPlugins 2021-09-10 14:56:49 -07:00
context_refresh.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
context_refresh_test.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_test.go plans/planfile: Create takes most arguments via a struct type 2021-10-01 14:43:58 -07:00
context_validate.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
context_validate_test.go core: Graph walk loads plugin schemas opportunistically 2021-09-10 14:56:49 -07:00
context_walk.go refactoring: ApplyMoves new return type 2021-09-22 09:01:10 -07:00
eval_context.go refactoring: ApplyMoves new return type 2021-09-22 09:01:10 -07:00
eval_context_builtin.go refactoring: ApplyMoves new return type 2021-09-22 09:01:10 -07:00
eval_context_builtin_test.go core: Replace contextComponentFactory with contextPlugins 2021-09-10 14:56:49 -07:00
eval_context_mock.go refactoring: ApplyMoves new return type 2021-09-22 09:01:10 -07:00
eval_count.go core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary 2021-09-20 09:06:22 -07:00
eval_count_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
eval_for_each.go remove IsMarked and ContainsMarked calls 2021-06-25 14:17:06 -04:00
eval_for_each_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
eval_provider.go core: EvalContextBuiltin no longer has a "Schemas" 2021-09-10 14:56:49 -07:00
eval_provider_test.go
eval_variable.go
evaluate.go Correct terraform.env deprecation message typo 2021-09-13 14:21:26 -05:00
evaluate_test.go Merge pull request #29559 from hashicorp/jbardin/optional-attrs 2021-09-13 08:58:11 -04:00
evaluate_valid.go core: Graph walk loads plugin schemas opportunistically 2021-09-10 14:56:49 -07:00
evaluate_valid_test.go core: Graph walk loads plugin schemas opportunistically 2021-09-10 14:56:49 -07:00
execute.go
features.go
graph.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
graph_builder.go
graph_builder_apply.go core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary 2021-09-20 09:06:22 -07:00
graph_builder_apply_test.go core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary 2021-09-20 09:06:22 -07:00
graph_builder_destroy_plan.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
graph_builder_eval.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
graph_builder_import.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
graph_builder_plan.go core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary 2021-09-20 09:06:22 -07:00
graph_builder_plan_test.go core: refactoring.ImpliedMoveStatements replaces NodeCountBoundary 2021-09-20 09:06:22 -07:00
graph_builder_test.go
graph_builder_validate.go
graph_dot.go
graph_dot_test.go
graph_interface_subgraph.go
graph_test.go de-linting 2021-09-01 11:36:21 -04:00
graph_walk.go
graph_walk_context.go refactoring: ApplyMoves new return type 2021-09-22 09:01:10 -07:00
graph_walk_operation.go
graph_walk_test.go
hook.go
hook_mock.go
hook_stop.go
hook_stop_test.go
hook_test.go
instance_expanders.go
marks.go
marks_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
node_data_destroy.go
node_data_destroy_test.go command/workspace_delete: Allow deleting a workspace with empty husks 2021-10-13 13:54:11 -07:00
node_local.go
node_local_test.go
node_module_expand.go
node_module_expand_test.go
node_module_variable.go configs: add ConstraintType to config.Variable 2021-09-13 08:51:32 -04:00
node_module_variable_test.go configs: add ConstraintType to config.Variable 2021-09-13 08:51:32 -04:00
node_output.go remove IsMarked and ContainsMarked calls 2021-06-25 14:17:06 -04:00
node_output_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
node_provider.go add comment about when we call ConfigureProvider 2021-10-08 15:23:36 -04:00
node_provider_abstract.go
node_provider_eval.go
node_provider_test.go Merge pull request #29039 from hashicorp/jbardin/sensitive 2021-06-25 17:11:59 -04:00
node_resource_abstract.go
node_resource_abstract_instance.go refactoring: ApplyMoves new return type 2021-09-22 09:01:10 -07:00
node_resource_abstract_instance_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
node_resource_abstract_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
node_resource_apply.go
node_resource_apply_instance.go
node_resource_apply_test.go
node_resource_destroy.go Check for nil change during apply 2021-10-08 16:46:29 -04:00
node_resource_destroy_deposed.go skip refreshing deposed during destroy plan 2021-10-07 16:51:48 -04:00
node_resource_destroy_deposed_test.go fixup tests for MockProvider changes 2021-10-08 08:42:06 -04:00
node_resource_plan.go core: Fix refresh-only interaction with orphans 2021-09-23 16:38:08 -04:00
node_resource_plan_destroy.go
node_resource_plan_instance.go
node_resource_plan_orphan.go core: Report ActionReasons when we plan to delete "orphans" 2021-09-23 14:37:08 -07:00
node_resource_plan_orphan_test.go fixup tests for MockProvider changes 2021-10-08 08:42:06 -04:00
node_resource_plan_test.go
node_resource_validate.go core: EvalContextBuiltin no longer has a "Schemas" 2021-09-10 14:56:49 -07:00
node_resource_validate_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
node_root_variable.go
node_root_variable_test.go configs: add ConstraintType to config.Variable 2021-09-13 08:51:32 -04:00
node_value.go
phasestate_string.go
provider_mock.go test that providers are configured for calls 2021-10-07 16:48:56 -04:00
provisioner_mock.go
provisioner_mock_test.go
reduce_plan.go
reduce_plan_test.go handle marks within ignore_changes 2021-07-19 16:42:26 -04:00
resource_provider_mock_test.go de-linting 2021-09-01 11:36:21 -04:00
schemas.go core: Context.Schemas in terms of contextPlugins methods 2021-09-10 14:56:49 -07:00
schemas_test.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
terraform_test.go test that providers are configured for calls 2021-10-07 16:48:56 -04:00
transform.go
transform_attach_config_provider.go
transform_attach_config_provider_meta.go
transform_attach_config_resource.go
transform_attach_schema.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_attach_state.go
transform_config.go
transform_config_test.go
transform_destroy_cbd.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_destroy_cbd_test.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_destroy_edge.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_destroy_edge_test.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_diff.go
transform_diff_test.go
transform_expand.go
transform_import_state.go return error for invalid resource import 2021-05-25 17:13:49 -04:00
transform_import_state_test.go fixup tests for MockProvider changes 2021-10-08 08:42:06 -04:00
transform_local.go
transform_module_expansion.go
transform_module_variable.go
transform_module_variable_test.go
transform_orphan_count.go
transform_orphan_count_test.go
transform_orphan_output.go
transform_orphan_resource.go deposed instances should not be counted as orphans 2021-05-20 09:36:45 -04:00
transform_orphan_resource_test.go deposed instances should not be counted as orphans 2021-05-20 09:36:45 -04:00
transform_output.go
transform_provider.go core: Provider transformers don't use the set of all available providers 2021-09-10 14:56:49 -07:00
transform_provider_test.go core: Provider transformers don't use the set of all available providers 2021-09-10 14:56:49 -07:00
transform_provisioner.go
transform_reference.go don't check all ancestors for data depends_on 2021-09-30 16:43:09 -04:00
transform_reference_test.go
transform_removed_modules.go
transform_resource_count.go
transform_root.go
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_state.go command/workspace_delete: Allow deleting a workspace with empty husks 2021-10-13 13:54:11 -07:00
transform_targets.go
transform_targets_test.go
transform_transitive_reduction.go
transform_transitive_reduction_test.go core: Opportunistic schema loading during graph construction 2021-09-10 14:56:49 -07:00
transform_variable.go
transform_vertex.go
transform_vertex_test.go
ui_input.go
ui_input_mock.go
ui_input_prefix.go
ui_input_prefix_test.go
ui_output.go
ui_output_callback.go
ui_output_callback_test.go
ui_output_mock.go
ui_output_mock_test.go
ui_output_provisioner.go
ui_output_provisioner_test.go
update_state_hook.go
update_state_hook_test.go
upgrade_resource_state.go
upgrade_resource_state_test.go
util.go
util_test.go
validate_selfref.go
validate_selfref_test.go
valuesourcetype_string.go
variables.go configs: add ConstraintType to config.Variable 2021-09-13 08:51:32 -04:00
variables_test.go
version_required.go
walkoperation_string.go