-
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
-target destroys the wrong resources without cause #4515
Comments
A couple quick addendums:
|
Thanks for the report, @justinclayton. Looking into it now.
Before |
yep, we're seeing this as well. if I do |
Also just encountered this. My scenario is a bit different. We renamed some resources, so the normal plan would be to create the new ones and destroy the old ones. However, we need to do it in 2 phases, so my plan was to use |
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. Includes test coverage proving that it fixes #4515. Will do further testing to determine whether this also fixes the various linked issues.
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. |
There seems to be a really scary pattern matching bug at play with the "resource address" method of referencing resources. Here's a simple repro:
After a successful
terraform apply
, run the following and be afraid:This is super-scary for two reasons:
We have reproduced this error across a couple of different providers, so it looks like a core bug for sure. In my reading of the docs,
-target
looks to be the only user of this "resource address" stuff. Everything else uses the TYPE.NAME.INDEX format everyone is used to. I'm not sure what the point of having two are, but that's a discussion for another time.The text was updated successfully, but these errors were encountered: