Commit Graph

29 Commits

Author SHA1 Message Date
Paul Hinze ddf794b7f7 core: fix provider config inheritence for deeply nested modules (#6186)
The flattening process was not properly drawing dependencies between provider
nodes in modules and their parent provider nodes.

Fixes #2832
Fixes #4443
Fixes #4865
2016-04-18 16:19:43 -07:00
Sander van Harmelen e938a645c5 Rename `graphNodeMissingProvider` to `graphNodeProvider`
It seems `graphNodeProvider` is a more descriptive name for this node…
2016-02-04 21:41:04 +01:00
Radek Simko 40b04154fe Add operation walkDestroy 2015-10-03 14:16:40 -07:00
Paul Hinze f97c635ef6 core: fix "provider ... couldn't be found" bug
The `CloseProviderTransformer` relies on the `ProvidedBy()` interface to
look up the proper dependency for the the graph nodes it adds. This
interface needs to yield the name of a provider, _AND_ for flattened
nodes it needs to yield the full path to a provider.

Destroy nodes did not implement this second part, which resulted in
"provider X couldn't be found" when both of these were true:

 * A module included a resource that dependend on a provider
 * The root did _NOT_ include a provider config

Implementing a proper ProvidedBy() on the flattened version of
destroy nodes solves the issue.

fixes #2581
2015-07-16 11:56:58 -05:00
Paul Hinze 184edbefcd core: remove now-unused flatten impls of close nodes
/cc @mitchellh
2015-06-29 12:46:24 -05:00
Paul Hinze 2d6a8c1f39 core: fix provider/close provider race when targeting
When targeting prunes out all the resource nodes between a provider and
its close node, there was no dependency to ensure the close happened
after the configure. Needed to add an explicit dependency from the close
to the provider.

This tweak highlighted the fact that CloseProviderTransformer needed to
happen after DisableProviderTransformer, since
DisableProviderTransformer inspects up-edges to decide what to disable,
and CloseProviderTransformer adds an up-edge.

fixes #2495
2015-06-29 11:22:51 -05:00
Mitchell Hashimoto 51a7e05f8a terraform: all providers for ProvidedBy() should be added 2015-06-26 12:00:02 -07:00
Mitchell Hashimoto c79a661ce1 Merge branch 'b-provider-alias-module' 2015-06-25 08:54:56 -07:00
Mitchell Hashimoto 29eadb8194 terraform: missing provider should add missing aliases [GH-2023] 2015-06-24 20:58:52 -07:00
Paul Hinze 38efe4cb80 dot: only draw provider close on `terraform greph -verbose` 2015-06-24 17:36:45 -05:00
Sander van Harmelen 110cf8b3d4 A close provider should not be an origin node
Removed the `DotOrigin()` func after review of the PR. With this change
the PR is up-to-spec to be merged (as just discussed with Paul in IRC).
2015-06-23 22:31:44 +02:00
Sander van Harmelen 0b1dbf31a3 core: close provider/provisioner connections
Currently Terraform is leaking goroutines and with that memory. I know
strictly speaking this maybe isn’t a real concern for Terraform as it’s
mostly used as a short running command line executable.

But there are a few of us out there that are using Terraform in some
long running processes and then this starts to become a problem.

Next to that it’s of course good programming practise to clean up
resources when they're not needed anymore. So even for the standard
command line use case, this seems an improvement in resource management.

Personally I see no downsides as the primary connection to the plugin
is kept alive (the plugin is not killed) and only unused connections
that will never be used again are closed to free up any related
goroutines and memory.
2015-06-19 21:52:50 +02:00
Paul Hinze 63241c991b core: flatten disabled providers 2015-05-13 11:50:11 -05:00
Mitchell Hashimoto bbb065d1ad terraform: add edge for missing providers 2015-05-01 18:39:24 -07:00
Mitchell Hashimoto 8f58367680 terraform: missing providers need to do dependencies 2015-05-01 18:08:06 -07:00
Mitchell Hashimoto 416e7a2077 terraform: missing provider should be flattenable 2015-05-01 15:23:37 -07:00
Mitchell Hashimoto 86d07d3b5b terraform: redo how flattening works 2015-05-01 15:18:40 -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
Paul Hinze d1b40de242 terraform: fix provider config inheritance during input
The provider config was not being properly merged across module
boundaries during the Input walk over the graph, so when a provider was
configured at the top level, resources in modules could improperly
trigger a request for input for a provider attribute that's already
defined.
2015-04-10 16:28:47 -05:00
Mitchell Hashimoto eda2e0fdfc terraform: fix disable provider tests 2015-04-09 08:51:38 -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
Mitchell Hashimoto c2593f6ada terraform: re-enable dot-graphs 2015-02-19 23:00:29 -08:00
Mitchell Hashimoto d847b2b672 terraform: provider config inheritance in modules 2015-02-19 12:07:59 -08:00
Mitchell Hashimoto 57ad9e2502 terraform: provider configuration validation 2015-02-19 12:07:55 -08:00
Mitchell Hashimoto 128c07e504 terraform: start eval stuff, untested 2015-02-19 12:07:54 -08:00
Mitchell Hashimoto 96a2d3e116 terraform: PruneProviderTransfomer 2015-02-19 12:07:54 -08:00
Mitchell Hashimoto 254689389a terraform: missing provider transform 2015-02-19 12:07:53 -08:00
Mitchell Hashimoto 01ec680019 terraform: ProviderTransform to map resources to providers by dep 2015-02-19 12:07:53 -08:00