opentofu/internal
James Bardin 3ea704ef81 Make the pre-destroy refresh a full plan
In order to complete the terraform destroy command, a refresh must first
be done to update state and remove any instances which have already been
deleted externally. This was being done with a refresh plan, which will
avoid any condition evaluations and avoid planning new instances. That
however can fail due to invalid references from resources that are
already missing from the state.

A new plan type to handle the concept of the pre-destroy-refresh is
needed here, which should probably be incorporated directly into the
destroy plan, just like the original refresh walk was incorporated into
the normal planning process. That however is major refactoring that is
not appropriate for a patch release.

Instead we make two discrete changes here to prevent blocking a destroy
plan. The first is to use a normal plan to refresh, which will enable
evaluation because missing and inconsistent instances will be planned
for creation and updates, allowing them to be evaluated. That is not
optimal of course, but does revert to the method used by previous
Terraform releases until a better method can be implemented.

The second change is adding a preDestroyRefresh flag to the planning
process. This is checked in any location which evalCheckRules is called,
and lets us change the diagnosticSeverity of the output to only be
warnings, matching the behavior of a normal refresh plan.
2022-11-11 14:33:50 -05:00
..
addrs addrs: ModuleSourceRemote.String correctly handles query string in URL 2022-08-31 09:13:24 -07:00
backend S3 Backend : Bucket key should not contain trailing slash 2022-10-31 16:19:26 -07:00
builtin add simple error indicating backend removal 2022-06-28 13:58:22 -04:00
checks core: Propagate check results accurately from plan to apply 2022-08-26 15:47:29 -07:00
cloud Add tests for cloud backend taskStage 2022-09-21 09:40:52 +08:00
command providercache: Ignore lock-mismatching global cache entries 2022-11-04 16:18:15 -07:00
communicator communicator/ssh: Fix crash using SSH+HTTP proxy 2022-05-03 08:24:59 -04:00
configs Do not apply type defaults to null values 2022-09-15 15:32:36 -04:00
copy test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
dag Clarify some comments in internal/dag 2022-10-06 15:10:33 -07:00
depsfile Ignore existing package hashes for providers lock command (#31389) 2022-07-20 13:27:24 +01:00
didyoumean didyoumean: move from "helper" to "internal" 2020-10-02 13:35:07 -07:00
e2e test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
earlyconfig tfdiags: Expose the "extra information" concept from HCL 2022-06-23 13:52:23 -07:00
experiments build: Use Go 1.19 2022-08-22 10:59:12 -07:00
getmodules add XTerraformGetLimit to prevent redirect loops 2022-06-01 12:46:22 -04:00
getproviders build: Use Go 1.19 2022-08-22 10:59:12 -07:00
grpcwrap s/Capabilities/ServerCapabilities/ 2022-07-06 13:47:35 -04:00
helper/slowmessage remove wrapped streams and readline 2021-10-28 11:51:39 -04:00
httpclient backend/azurerm: removing ADAL support 2022-05-18 16:56:10 +02:00
initwd expand module subdir globs 2022-08-17 16:27:58 -04:00
instances InstancesForModule should not panic 2021-12-17 13:31:41 -05:00
ipaddr build: Use Go 1.19 2022-08-22 10:59:12 -07:00
lang lang/funcs: "timecmp" function 2022-08-25 10:15:42 -07:00
legacy build: Use Go 1.19 2022-08-22 10:59:12 -07:00
logging cleanup panic output 2021-12-17 11:57:52 -05:00
modsdir Refactoring of module source addresses and module installation 2021-06-03 08:50:34 -07:00
moduledeps Move plugin/ and plugin6/ to internal/plugin{,6}/ 2021-05-17 14:09:07 -07:00
moduletest fixup broken test fixtures 2022-07-06 13:47:35 -04:00
plans update UIMode comment 2022-10-20 13:13:58 -04:00
plugin s/Capabilities/ServerCapabilities/ 2022-07-06 13:47:35 -04:00
plugin6 s/Capabilities/ServerCapabilities/ 2022-07-06 13:47:35 -04:00
provider-simple s/Capabilities/ServerCapabilities/ 2022-07-06 13:47:35 -04:00
provider-simple-v6 s/Capabilities/ServerCapabilities/ 2022-07-06 13:47:35 -04:00
provider-terraform/main Move plugin/ and plugin6/ to internal/plugin{,6}/ 2021-05-17 14:09:07 -07:00
providercache providercache: Ignore lock-mismatching global cache entries 2022-11-04 16:18:15 -07:00
providers s/Capabilities/ServerCapabilities/ 2022-07-06 13:47:35 -04:00
provisioner-local-exec/main Move plugin/ and plugin6/ to internal/plugin{,6}/ 2021-05-17 14:09:07 -07:00
provisioners Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
refactoring allow cross-package move statements (#31556) 2022-08-16 16:52:57 +02:00
registry revert "run goimports" 2022-08-01 16:26:26 -05:00
repl Unify all sensitive value plan output as "(sensitive value)" 2022-10-24 12:50:46 -06:00
replacefile Upgrade to Go 1.17 2021-08-17 15:20:05 -07:00
states normalize empty CheckResults fields in stateV4 2022-11-01 16:18:38 -04:00
terminal remove the use of panicwrap 2021-10-28 11:51:39 -04:00
terraform Make the pre-destroy refresh a full plan 2022-11-11 14:33:50 -05:00
tfdiags build: Use Go 1.19 2022-08-22 10:59:12 -07:00
tfplugin5 docs/plugin-protocol: Add notes about missing configuration in ReadResource and UpgradeResourceState request messages (#31998) 2022-10-13 16:29:34 -04:00
tfplugin6 docs/plugin-protocol: Add notes about missing configuration in ReadResource and UpgradeResourceState request messages (#31998) 2022-10-13 16:29:34 -04:00