mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-20 21:52:57 -06:00
3ea704ef81
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. |
||
---|---|---|
.. | ||
addrs | ||
backend | ||
builtin | ||
checks | ||
cloud | ||
command | ||
communicator | ||
configs | ||
copy | ||
dag | ||
depsfile | ||
didyoumean | ||
e2e | ||
earlyconfig | ||
experiments | ||
getmodules | ||
getproviders | ||
grpcwrap | ||
helper/slowmessage | ||
httpclient | ||
initwd | ||
instances | ||
ipaddr | ||
lang | ||
legacy | ||
logging | ||
modsdir | ||
moduledeps | ||
moduletest | ||
plans | ||
plugin | ||
plugin6 | ||
provider-simple | ||
provider-simple-v6 | ||
provider-terraform/main | ||
providercache | ||
providers | ||
provisioner-local-exec/main | ||
provisioners | ||
refactoring | ||
registry | ||
repl | ||
replacefile | ||
states | ||
terminal | ||
terraform | ||
tfdiags | ||
tfplugin5 | ||
tfplugin6 |