Commit Graph

63 Commits

Author SHA1 Message Date
Mitchell Hashimoto ab4ebcc5c7
terraform: TargetsTransformer on destroy plan
This enables targeting to work properly on planning destroys
2016-10-22 12:12:30 -07:00
Mitchell Hashimoto 94e1bab65d terraform: fill in more flat interfaces 2015-05-01 15:28:41 -07:00
Mitchell Hashimoto 86d07d3b5b terraform: redo how flattening works 2015-05-01 15:18:40 -07:00
Mitchell Hashimoto e544e1d401 terraform: hook up the proxies 2015-05-01 11:45:42 -07:00
Mitchell Hashimoto 5e767f63b9 terraform: move module to its own file 2015-04-30 19:23:52 -07:00
Mitchell Hashimoto 15ca84a682 terraform: module dependencies in graph use full name (FOR THE FUTURE) 2015-04-30 17:19:01 -07:00
Paul Hinze d30d88e327 Merge pull request #1655 from hashicorp/f-build-graph-during-plan
core: validate on verbose graph to detect some cycles earlier
2015-04-30 16:08:33 -05:00
Mitchell Hashimoto 2ca181d42d terraform: add output orphan transformer 2015-04-29 11:18:58 -07:00
Paul Hinze ce49dd6080 core: graph command gets -verbose and -draw-cycles
When you specify `-verbose` you'll get the whole graph of operations,
which gives a better idea of the operations terraform performs and in
what order.

The DOT graph is now generated with a small internal library instead of
simple string building. This allows us to ensure the graph generation is
as consistent as possible, among other benefits.

We set `newrank = true` in the graph, which I've found does just as good
a job organizing things visually as manually attempting to rank the nodes
based on depth.

This also fixes `-module-depth`, which was broken post-AST refector.
Modules are now expanded into subgraphs with labels and borders. We
have yet to regain the plan graphing functionality, so I removed that
from the docs for now.

Finally, if `-draw-cycles` is added, extra colored edges will be drawn
to indicate the path of any cycles detected in the graph.

A notable implementation change included here is that
{Reverse,}DepthFirstWalk has been made deterministic. (Before it was
dependent on `map` ordering.) This turned out to be unnecessary to gain
determinism in the final DOT-level implementation, but it seemed
a desirable enough of a property that I left it in.
2015-04-27 09:23:47 -05:00
Mitchell Hashimoto d2011438f7 Merge pull request #1587 from hashicorp/b-count-deps
terraform: inner-count dependencies work [GH-1540]
2015-04-22 08:10:24 +02:00
Matt Good 21b0a03d70 Support for multiple providers of the same type
Adds an "alias" field to the provider which allows creating multiple instances
of a provider under different names. This provides support for configurations
such as multiple AWS providers for different regions. In each resource, the
provider can be set with the "provider" field.

(thanks to Cisco Cloud for their support)
2015-04-20 14:14:34 -07:00
Mitchell Hashimoto 2fffec9545 terraform: inner-count dependencies work [GH-1540] 2015-04-18 15:56:43 -07:00
Mitchell Hashimoto 2934824069 terraform: remove debug 2015-04-14 13:20:23 -07:00
Mitchell Hashimoto 486cde44ec terraform: when pruning destroy, only match exact nodes, or exact counts 2015-04-14 13:17:08 -07:00
Mitchell Hashimoto b64fd8401c terraform: prune tainted destroys if no tainted in state [GH-1475] 2015-04-14 10:48:45 -07:00
Mitchell Hashimoto bcff7e070c terraform: don't prune, but disable, inherited configs [GH-1447] 2015-04-09 08:48:08 -07:00
Mitchell Hashimoto 36520121b1 terraform: disable providers that are only used by modules 2015-04-08 21:14:19 -07:00
Paul Hinze c6300d511c core: formalize resource addressing
Only used in targets for now. The plan is to use this for interpolation
as well.

This allows us to target:

 * individual resources expanded by `count` using bracket / index notation.
 * deposed / tainted resources with an `InstanceType` field after name

Docs to follow.
2015-03-31 15:04:10 -05:00
Paul Hinze 596e891b80 core: [refactor] pull Deposed out of Tainted list 2015-03-04 12:25:47 -06:00
Mitchell Hashimoto 2389251c38 terraform: catch scenario where both "foo" and "foo.0" are in state 2015-03-01 21:28:41 -08:00
Paul Hinze c03e44106f core: band-aid fix for tainted double destroy
After a lot of fun debugging with @mitchellh we finally have a diagnosis
for #1056.

I'm going to attempt to reproduce the diagnosis in prose to test out my
understanding.

----

The `DestroyTransformer` runs twice:

 * `DestroyPrimary` mode creates destroy nodes for normal resources
 * `DestroyTainted` mode creates destroy nodes for tainted resources

These destroy nodes are specializations of `GraphConfigNode`, which has
a `DynamicExpand` step.

In `DynamicExpand` we have a race condition between the normal destroy
node and the tainted destroy node for a given resource when
`CreateBeforeDestroy` is off.

The `DestroyTainted` `GraphConfigNode` must run the `TaintedTransform`
to draw out tainted nodes, since it is reponsible for destroying them
for replacement.

The `DestroyPrimary` `GraphConfigNode` _also_ runs `TaintedTransform` -
this is to catch `Deposed` nodes from CBD, which are piggy backing on
the end of the `Tainted` list.

Here's the bug: when CBD is off and you start an apply with a tainted
resource in your state, both `DestroyPrimary` and `DestroyTainted` catch
it and create their own `graphNodeTaintedResource` in their respective
subgraphs.

If parallelism is disabled, this doesn't happen because the
`DestroyPrimary` subgraph resolves completely before the
`DestroyTainted` node does its `DynamicExpand`, so the `Tainted` list
has been cleared by the time `DestroyTainted` is expanding. With
parallelism, each of these two subgraphs plays out in its own goroutine
simultaneously, and each picks up the tainted resource(s) that the apply
starts with.  So you get two `graphNodeTaintedResource` nodes, and two
destroys.

This band-aid fixes that by skipping the TaintedTransform alltogether in
the `DestroyPrimary` node if CBD is off.

A better fix will follow, which involves reworking the `Deposed` concept
so it no longer piggybacks on `Tainted`.

fixes #1056
2015-02-26 22:32:50 -06:00
Mitchell Hashimoto c2593f6ada terraform: re-enable dot-graphs 2015-02-19 23:00:29 -08:00
Mitchell Hashimoto e68ea0d38f terraform: only keep the destroy if we decreased counts 2015-02-19 12:08:33 -08: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 8d2ed22e97 terraform: prune destroy nodes for resources not in diff 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto b52881d232 terraform: clean up EvalNodes 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto 1c713878b0 terraform: fix outputs on destroy 2015-02-19 12:08:07 -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 c70cc682ea terraform: resource provisioner self references are not put in the graph 2015-02-19 12:08:06 -08:00
Mitchell Hashimoto 819aed67d4 terraform: provisioners 2015-02-19 12:08:06 -08:00
Mitchell Hashimoto 9b7d1509fc terraform: outputs in apply 2015-02-19 12:08:05 -08:00
Mitchell Hashimoto ec6ce69e90 terraform: destroy module plan 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto 4ccb12508a terraform: decreasing counts works 2015-02-19 12:08:03 -08:00
Mitchell Hashimoto d7dc0291f5 terraform: put destroy nodes into the graph 2015-02-19 12:08:03 -08:00
Mitchell Hashimoto 354a35afb0 terraform: properly interpolate variable counts 2015-02-19 12:08:03 -08:00
Mitchell Hashimoto 8365d39d26 terraform: fix more plan tests 2015-02-19 12:08:03 -08:00
Mitchell Hashimoto de6827b3ed terraform: calculate outputs and store it into the state 2015-02-19 12:08:02 -08:00
Mitchell Hashimoto 84cf7f1179 terraform: outputs show up in the graph 2015-02-19 12:08:02 -08:00
Mitchell Hashimoto 23d097ee53 terraform: module inputs are passed through to subgraphs 2015-02-19 12:08:01 -08:00
Mitchell Hashimoto d847b2b672 terraform: provider config inheritance in modules 2015-02-19 12:07:59 -08:00
Mitchell Hashimoto ea42deb66c terraform: provisioner transforms 2015-02-19 12:07:58 -08:00
Mitchell Hashimoto 584eac9e92 terraform: EvalValidateCount 2015-02-19 12:07:57 -08:00
Mitchell Hashimoto 28a23a45f4 terraform: dynamic subgraph expansion for count 2015-02-19 12:07:57 -08:00
Mitchell Hashimoto 4692f9809f terraform: module nodes expand 2015-02-19 12:07:57 -08:00
Mitchell Hashimoto 57ad9e2502 terraform: provider configuration validation 2015-02-19 12:07:55 -08:00
Mitchell Hashimoto f9f18122ed terraform: basic provider validation! 2015-02-19 12:07:55 -08:00
Mitchell Hashimoto c308405b53 terraform: validation in progress 2015-02-19 12:07:55 -08:00