Commit Graph

18 Commits

Author SHA1 Message Date
Mitchell Hashimoto
f3a62c694d
terraform: when promoting non-CBD to CBD, mark the config as such
Fixes #10439

When a CBD resource depends on a non-CBD resource, the non-CBD resource
is auto-promoted to CBD. This was done in
cf3a259. This PR makes it so that we
also set the config CBD to true. This causes the proper runtime
execution behavior to occur where we depose state and so on.

So in addition to simple graph edge tricks we also treat the non-CBD
resources as CBD resources.
2016-12-02 09:46:04 -05:00
James Bardin
cf3a259cd9 fix CreateBeforeDestroy with datasources
The graph transformation we implement around create_before_destroy
need to re-order all resources that depend on the create_before_destroy
resource. Up until now, we've requires that users mark all of these
resources as create_before_destroy. Data soruces however don't have a
lifecycle block for create_before_destroy, and could not be marked this
way.

This PR checks each DestroyNode that doesn't implement CreateBeforeDestroy
for any ancestors that do implement CreateBeforeDestroy. If there are
any, we inherit the behavior and re-order the graph as such.
2016-11-03 17:08:24 -04:00
Sander van Harmelen
8560f50cbc
Change taint behaviour to act as a normal resource
This means it’s shown correctly in a plan and takes into account any
actions that are dependant on the tainted resource and, vice verse, any
actions that the tainted resource depends on.

So this changes the behaviour from saying this resource is tainted so
just forget about it and make sure it gets deleted in the background,
to saying I want that resource to be recreated (taking into account the
existing resource and it’s place in the graph).
2016-05-26 19:55:26 -05:00
Mitchell Hashimoto
7031cb145c terraform: orphan dependencies should be inverted 2015-06-23 20:41:02 -07:00
Paul Hinze
842d66183b core: respect roots in CBD transform
Because CBD now runs after a RootTransformer, it's now operating on a
graph that _may_ have had a graphNodeRoot added to it (a noop node whose
only purpose is to be a root).

CBD includes a step that tells the destroy node to depend on any parents
of the create node. When one of those parents was "root", this was
causing the destroy node to depend on "root", making it cease to be an
actual root node.

Because graphNodeRoot is a singleton, the follow-up RootTransformer was
not sufficient to slap another root on top - it wasn't being seen as a
fresh node, so edges were just accumulating, and we ended up in a state
with "no roots".

refs #1903 (not sure if this will fix all the "no root found" cases, or
just the one I bumped into)
2015-05-13 17:53:42 -05:00
Mitchell Hashimoto
6752ccfe10 terraform: only include variables in graph if count of a resource
depends
2015-05-07 10:50:56 -07:00
Mitchell Hashimoto
6b2e0b938d terraform: only omit vars on full destroys 2015-05-06 20:55:14 -07:00
Mitchell Hashimoto
cc0c208364 terraform: skip outputs for destroy graphs 2015-05-02 18:28:26 -07:00
Mitchell Hashimoto
6afc14982a terraform: destroy transform must happen globally 2015-05-02 18:21:00 -07:00
Mitchell Hashimoto
1ed37f0b7f terraform: change DiffId to DiffInclude to allow smarter logic
This lets us check for orphans properly.
2015-02-19 12:08:33 -08:00
Mitchell Hashimoto
4789f16796 terraform: tainted destroy nodes 2015-02-19 12:08:33 -08:00
Mitchell Hashimoto
991611857a terraform: remove requirement that DestroyNode return the SAME node 2015-02-19 12:08:33 -08:00
Mitchell Hashimoto
9c14315336 terraform: don't prune if there are known tainted resources 2015-02-19 12:08:33 -08:00
Mitchell Hashimoto
8d2ed22e97 terraform: prune destroy nodes for resources not in diff 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto
8db6f722d2 terraform: CBD edge transpositions must happen atomically 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto
f7f1f17b49 terraform: create before destroy 2015-02-19 12:08:07 -08:00
Mitchell Hashimoto
742b45886a terraform: destroy nodes work properly 2015-02-19 12:08:06 -08:00
Mitchell Hashimoto
d7dc0291f5 terraform: put destroy nodes into the graph 2015-02-19 12:08:03 -08:00