Skip to content
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

Closed
AVVS opened this issue Dec 30, 2015 · 3 comments · Fixed by #4574
Closed

terraform destroy -target=module.xxx #4462

AVVS opened this issue Dec 30, 2015 · 3 comments · Fixed by #4574

Comments

@AVVS
Copy link

AVVS commented Dec 30, 2015

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 destroy some_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 behaviour

@jen20
Copy link
Contributor

jen20 commented Jan 4, 2016

@AVVS Thanks of reporting this. I will investigate this and try to reproduce - it certainly sounds like a core bug to me.

@stvnwrgs
Copy link
Contributor

We saw some similar problems when we tried to destroy a single instance.

terraform plan -destroy -target=module.xxx.module.machine_id
it says nothing.

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!

phinze added a commit that referenced this issue Jan 19, 2016
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
phinze added a commit that referenced this issue Jan 19, 2016
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
bigkraig pushed a commit to bigkraig/terraform that referenced this issue Mar 1, 2016
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
@ghost
Copy link

ghost commented Apr 28, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants