-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Fix destroy-time handling of outputs and local values #17241
Merged
Merged
Commits on Jan 29, 2018
-
always evaluate locals, even during destroy
Destroy-time provisioners require us to re-evaluate during destroy. Rather than destroying local values, which doesn't do much since they aren't persisted to state, we always evaluate them regardless of the type of apply. Since the destroy-time local node is no longer a "destroy" operation, the order of evaluation need to be reversed. Take the existing DestroyValueReferenceTransformer and change it to reverse the outgoing edges, rather than in incoming edges. This makes it so that any dependencies of a local or output node are destroyed after evaluation. Having locals evaluated during destroy failed one other test, but that was the odd case where we need `id` to exist as an attribute as well as a field.
Configuration menu - View commit details
-
Copy full SHA for 7da1a39 - Browse repository at this point
Copy the full SHA 7da1a39View commit details -
add destroy provisioner test with locals, outputs
Add a complex destroy provisioner testcase using locals, outputs and variables. Add that pesky "id" attribute to the instance states for interpolation.
Configuration menu - View commit details
-
Copy full SHA for 7ac0a46 - Browse repository at this point
Copy the full SHA 7ac0a46View commit details -
Always evaluate outputs during destroy, just like we did for locals. This breaks existing tests, which we will handle separately. Don't reverse output/local node evaluation order during destroy, as they are both being evaluated.
Configuration menu - View commit details
-
Copy full SHA for 0813955 - Browse repository at this point
Copy the full SHA 0813955View commit details
Commits on Jan 30, 2018
-
Now that outputs are always evaluated, we still need a way to remove them from state when they are destroyed. Previously, outputs were removed during destroy from the same "Applyable" node type that evaluates them. Now that we need to possibly both evaluate and remove output during an apply, we add a new node - NodeDestroyableOutput. This new node is added to the graph by the DestroyOutputTransformer, which make the new destroy node depend on all descendants of the output node. This ensures that the output remains in the state as long as everything which may interpolate the output still exists.
Configuration menu - View commit details
-
Copy full SHA for d31fe5a - Browse repository at this point
Copy the full SHA d31fe5aView commit details -
add a more complex locals test
Using destroy provisioners again for edge cases during destroy.
Configuration menu - View commit details
-
Copy full SHA for 2d138d9 - Browse repository at this point
Copy the full SHA 2d138d9View commit details -
add PruneUnusedValuesTransformer
Since outputs and local nodes are always evaluated, if the reference a resource form the configuration that isn't in the state, the interpolation could fail. Prune any local or output values that have no references in the graph.
Configuration menu - View commit details
-
Copy full SHA for 99867f0 - Browse repository at this point
Copy the full SHA 99867f0View commit details -
catch missing id attribute during interpolation
The id attribute can be missing during the destroy operation. While the new destroy-time ordering of outputs and locals should prevent resources from having their id attributes set to an empty string, there's no reason to error out if we have the canonical ID field available. This still interrogates the attributes map first to retain any previous behavior, but in the future we should settle on a single ID location.
Configuration menu - View commit details
-
Copy full SHA for a2f8482 - Browse repository at this point
Copy the full SHA a2f8482View commit details -
Configuration menu - View commit details
-
Copy full SHA for ca4178b - Browse repository at this point
Copy the full SHA ca4178bView commit details
Commits on Jan 31, 2018
-
Make sure outputs are removed when targeting
Similar to NodeApplyableOuptut, NodeDestroyableOutputs also need to stay in the graph if any ancestor nodes Use the same GraphNodeTargetDownstream method to keep them from being pruned, since they are dependent on the output node and all its descendants.
Configuration menu - View commit details
-
Copy full SHA for 7fbc35a - Browse repository at this point
Copy the full SHA 7fbc35aView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.