-
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
Orphan addressing / targeting #4574
Conversation
I'm finding that with in releases since about 0.6.6, when I "apply -target=...", orphaned resources are destroyed. Does 4574 change the behaviour such that resources in the state file which are no longer defined in the *.tf files will be ignored rather than destroyed on "apply"? |
1735e99
to
83d5ea4
Compare
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
83d5ea4
to
a0d3245
Compare
Alright @mitchellh / @jen20 this should be ready for review. Confirmed it fixes several open bugs and included a covering test for each one. |
LGTM! I still think at some point we should just measure twice and cut once the targeting syntax to make sure we can get it fully right and test the full supported syntax. But this doesn't appear to introduce any except make the old one work properly so LGTM. |
Thanks for the review! Merging. 🚢
What's there in |
So excited to see this merged. Will be verifying this fixes our issues today. |
Can confirm this works as of e865c34 |
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. |
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