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

core: Fix destroy when module vars used in provider config #7131

Merged
merged 1 commit into from
Jun 12, 2016

Conversation

phinze
Copy link
Contributor

@phinze phinze commented Jun 12, 2016

For terraform destroy, we currently build up the same graph we do for plan and apply and we do a walk with a special Diff that says "destroy everything".

We have fought the interpolation subsystem time and again through this code path. Beginning in #2775 we gained a new feature to selectively prune out problematic graph nodes. The past chain of destroy fixes I have been involved with (#6557, #6599, #6753) have attempted to massage the "noop" definitions to properly handle the edge cases reported.

"Variable is depended on by provider config" is another edge case we add here and try to fix.

This dive only makes me more convinced that the whole terraform destroy code path needs to be reworked.

For now, I went with a "surgical strike" approach to the problem expressed in #7047. I found a couple of issues with the existing Noop and DestroyEdgeInclude logic, especially with regards to flattening, but I'm explicitly ignoring these for now so we can get this particular bug fixed ahead of the 0.7 release. My hope is that we can circle around with a fully specced initiative to refactor terraform destroy's graph to be more state-derived than config-derived.

Until then, this fixes #7407

For `terraform destroy`, we currently build up the same graph we do for
`plan` and `apply` and we do a walk with a special Diff that says
"destroy everything".

We have fought the interpolation subsystem time and again through this
code path. Beginning in #2775 we gained a new feature to selectively
prune out problematic graph nodes. The past chain of destroy fixes I
have been involved with (#6557, #6599, #6753) have attempted to massage
the "noop" definitions to properly handle the edge cases reported.

"Variable is depended on by provider config" is another edge case we add
here and try to fix.

This dive only makes me more convinced that the whole `terraform
destroy` code path needs to be reworked.

For now, I went with a "surgical strike" approach to the problem
expressed in #7047. I found a couple of issues with the existing
Noop and DestroyEdgeInclude logic, especially with regards to
flattening, but I'm explicitly ignoring these for now so we can get this
particular bug fixed ahead of the 0.7 release. My hope is that we can
circle around with a fully specced initiative to refactor `terraform
destroy`'s graph to be more state-derived than config-derived.

Until then, this fixes #7407
@phinze
Copy link
Contributor Author

phinze commented Jun 12, 2016

cc @jen20

@jen20
Copy link
Contributor

jen20 commented Jun 12, 2016

LGTM - seems to work from this side. I agree that terraform destroy needs reworking entirely, though it's somewhat unclear how we'd end up materialising the relationships for destroy order purely from state.

@jen20 jen20 merged commit 445cd84 into master Jun 12, 2016
@jen20 jen20 deleted the b-destroy-module-provider-config branch June 12, 2016 09:38
@ghost
Copy link

ghost commented Apr 25, 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 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants