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

destroy -target=module.somemodule.resource.name destroys the entire module #2538

Closed
mikeyhill opened this issue Jun 28, 2015 · 3 comments · Fixed by #4574
Closed

destroy -target=module.somemodule.resource.name destroys the entire module #2538

mikeyhill opened this issue Jun 28, 2015 · 3 comments · Fixed by #4574

Comments

@mikeyhill
Copy link

Terraform v0.6.0-dev (aea85e40274d17732f15193c00061a2a686c5ae2)

terraform destroy -var-file=variables/dev.tf  -target=module.bq-varnish.aws_iam_server_certificate.varnish-iam-certs

Destroys all of module.bq-varnish rather unexpectedly - From the behavior of plan/apply I would expect destroy to work the same with a specific resource.

 terraform destroy -var-file=variables/dev.tf  -target=module.bq-varnish.aws_iam_server_certificate.varnish-iam-certs
    Do you really want to destroy?
      Terraform will delete all your managed infrastructure.
      There is no undo. Only 'yes' will be accepted to confirm.

      Enter a value: yes

    module.bq-varnish.aws_elb.varnish-elb: Refreshing state... (ID: dev-varnish-elb)
    module.bq-varnish.aws_lb_cookie_stickiness_policy.varnish-sticky-cookie: Refreshing state... (ID: dev-varnish-elb:80:dev-varnish-sticky-cookie)
    module.bq-varnish.template_file.varnish-cloud-init: Refreshing state... (ID: b5fe0014c71bbb13fc8aa560d86166dd86c89faae0cf0ce78ea335bddfc4ffdb)
    module.bq-varnish.aws_launch_configuration.varnish-launch-config: Refreshing state... (ID: dev-varnish-launch-config)
    module.bq-varnish.aws_autoscaling_group.varnish-autoscaling-group: Refreshing state... (ID: dev-varnish-autoscaling-group)
    aws_lb_cookie_stickiness_policy.varnish-sticky-cookie: Destroying...
    aws_autoscaling_group.varnish-autoscaling-group: Destroying...
    aws_lb_cookie_stickiness_policy.varnish-sticky-cookie: Destruction complete
    aws_autoscaling_group.varnish-autoscaling-group: Destruction complete
    aws_launch_configuration.varnish-launch-config: Destroying...
    aws_launch_configuration.varnish-launch-config: Destruction complete
    template_file.varnish-cloud-init: Destroying...
    template_file.varnish-cloud-init: Destruction complete
    aws_elb.varnish-elb: Destroying...
    aws_elb.varnish-elb: Destruction complete
@josephholsten
Copy link
Contributor

@mikeyhill was the resource deleted from the config? this sounds similar to #4515

@mikeyhill
Copy link
Author

@josephholsten - it's been a while but yes, I do recall it removing it from the config.

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