-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
terraform destroy -target=module.xxx #4462
Comments
@AVVS Thanks of reporting this. I will investigate this and try to reproduce - it certainly sounds like a core bug to me. |
We saw some similar problems when we tried to destroy a single instance.
If we fuck up the machine id, it tries to destroy the whole xxx module!? I dont know if this is correlating or not, but it is definitly a bad behavior! |
Instead of trying to skip non-targeted orphans as they are added to the graph in OrphanTransformer, remove knowledge of targeting from OrphanTransformer and instead make the orphan resource nodes properly addressable. That allows us to use existing logic in TargetTransformer to filter out the nodes appropriately. This does require adding TargetTransformer to the list of transforms that run during DynamicExpand so that targeting can be applied to nodes with expanded counts. Fixes #4515 Fixes #2538 Fixes #4462
Instead of trying to skip non-targeted orphans as they are added to the graph in OrphanTransformer, remove knowledge of targeting from OrphanTransformer and instead make the orphan resource nodes properly addressable. That allows us to use existing logic in TargetTransformer to filter out the nodes appropriately. This does require adding TargetTransformer to the list of transforms that run during DynamicExpand so that targeting can be applied to nodes with expanded counts. Fixes #4515 Fixes #2538 Fixes #4462
Instead of trying to skip non-targeted orphans as they are added to the graph in OrphanTransformer, remove knowledge of targeting from OrphanTransformer and instead make the orphan resource nodes properly addressable. That allows us to use existing logic in TargetTransformer to filter out the nodes appropriately. This does require adding TargetTransformer to the list of transforms that run during DynamicExpand so that targeting can be applied to nodes with expanded counts. Fixes hashicorp#4515 Fixes hashicorp#2538 Fixes hashicorp#4462
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
it doesn't destroy instances that are referenced in the nested modules, ie:
module.xxx:
module "chef-machine" {
}
some_ipaddress_resource ...
module.chef-machine:
some_instance_resource
When doing
terraform destroy -target=module.xxx
it will destroysome_ipaddress_resource
only,leaving module.chef-machine resources up
When doing
terraform destroy -target=module.xxx.module.chef-machine
it will destroy chef-machine resources, leaving other module.xxx resources up, which is correct behaviourThe text was updated successfully, but these errors were encountered: