Commit Graph

842 Commits

Author SHA1 Message Date
Radek Simko 0fc8882e29 Expose Terraform version internally & externally 2015-06-21 12:24:42 +01:00
Clint Shryock 78e7519efa Updates from go generate 2015-06-03 08:37:57 -05:00
Sam Boyer b82bd0c280 Condense switch fallthroughs into expr lists 2015-05-26 21:52:36 -04:00
Mitchell Hashimoto b251afb5af terraform: orphan module should flatten 2015-05-14 20:54:33 -07:00
Mitchell Hashimoto 0728e25f43 terraform: env vars are lower priority 2015-05-14 09:58:30 -07:00
Mitchell Hashimoto fe74d69852 terraform: validation should succeed if env var set [GH-1930] 2015-05-13 20:09:05 -07:00
Mitchell Hashimoto 6982ebc142 Merge pull request #1955 from ctiwald/ct/fix-vet-complaints
Fix three trivial errors 'go vet' discovered.
2015-05-13 18:24:42 -07:00
Christopher Tiwald 2252b83d9a Fix three trivial errors 'go vet' discovered. 2015-05-13 21:23:07 -04: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
Paul Hinze b0eafeb212 core: fix deadlock w/ CBD + modules
fixes #1947

Root cause was a bad edge being made by the CBD transform going from the
flattened destroy node to the unflattened create node, which was no
longer in the graph. The destroy node therefore had a dependency that
could never be satisfied, which locked up the walk.
2015-05-13 13:05:43 -05:00
Paul Hinze 63241c991b core: flatten disabled providers 2015-05-13 11:50:11 -05:00
Paul Hinze a5e4e3de59 core: flatten orphan modules 2015-05-13 11:33:29 -05:00
Paul Hinze 9c7fb87ca8 core: flatten orphan outputs
Hit the "unflattenable node" error again with these.

This fixes it.
2015-05-12 15:10:21 -05:00
Paul Hinze 0273732dec core: make orphans flattenable
Got this while playing around in a module:

> * unflattenable node: aws_security_group.internal (orphan)
> *terraform.graphNodeOrphanResource

Basically just copied implementation from
d503cc2d82
2015-05-11 22:24:11 -05:00
Mitchell Hashimoto f86dc22caf terraform: return unknown if resource not found 2015-05-11 14:57:20 -07:00
Mitchell Hashimoto fc084cc03e Merge pull request #1857 from hashicorp/b-multi-mod
terraform: flattening multi-level modules works
2015-05-07 13:34:35 -07:00
Mitchell Hashimoto 6d56a2ac86 terraform: comment 2015-05-07 13:10:25 -07:00
Mitchell Hashimoto 7c3e355bb0 terraform: flattening multi-level modules works 2015-05-07 13:08:59 -07: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 19b33326be terraform: don't include variables in destroy node requirements 2015-05-06 20:13:19 -07:00
Paul Hinze 5d50264c31 core: module targeting
Adds the ability to target resources within modules, like:

module.mymod.aws_instance.foo

And the ability to target all resources inside a module, like:

module.mymod

Closes #1434
2015-05-05 21:58:48 -05:00
Paul Hinze 0fff7d1673 core: validate graph w/ diff during plan phase
This reimplements my prior attempt at nipping issues where a plan did
not yield the same cycle an apply did. My prior attempt was to have
ctx.Validate generate a "Verbose" worst-case graph. It turns out that
skipping PruneDestroyTransformer to generate this graph misses important
heuristics that prevent cycles by dropping destroy nodes that are
determined to be unused.

This resulted in Validate improperly failing in scenarios where these
heuristics would have broken the cycle.

We detected the problem during the work on #1781 and worked around the
issue by reverting to the non-Verbose graph in Validate.

This commit accomplishes the original goal in a better way - by
generating the full graph and checking it once Plan has calculated the
diff. This guarantees that any graph issue that would be caught by Apply
will be caught by Plan.
2015-05-05 17:24:44 -05:00
Mitchell Hashimoto 8c34e9a36a terraform: provisionedby prefixed 2015-05-05 13:04:27 -07:00
Mitchell Hashimoto d503cc2d82 terraform: flattenable graphNodeMissingProvisioner 2015-05-05 12:45:28 -07:00
Mitchell Hashimoto 6d4969f64c terraform: run prune destroy on validate 2015-05-05 12:11:49 -07:00
Paul Hinze c3ce23c7b4 core: failing test for a bad module cycle
passing output of one module into input of the following module results
in a cycle
2015-05-04 18:58:29 -05:00
Mitchell Hashimoto 13f3daa3b3 terraform: update comment on interpolater stuff 2015-05-04 10:51:34 -07:00
Mitchell Hashimoto 2f3f680505 terraform: update comment 2015-05-04 10:49:34 -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 542ddb881a terraform: disable destroy mode for flattened nodes 2015-05-01 18:44:07 -07:00
Mitchell Hashimoto bbb065d1ad terraform: add edge for missing providers 2015-05-01 18:39:24 -07:00
Mitchell Hashimoto 23b6acc29d terraform: add module destroy node to graph 2015-05-01 18:26:35 -07:00
Mitchell Hashimoto 1f10dfef2d terraform: remove test 2015-05-01 18:17:49 -07:00
Mitchell Hashimoto 8f58367680 terraform: missing providers need to do dependencies 2015-05-01 18:08:06 -07:00
Mitchell Hashimoto 7fd432b076 terraform: providers in flattened graphs should depend on the parent 2015-05-01 16:41:49 -07:00
Mitchell Hashimoto c207beda36 terraform: set variables in the proper location 2015-05-01 16:29:19 -07:00
Mitchell Hashimoto 94e1bab65d terraform: fill in more flat interfaces 2015-05-01 15:28:41 -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
Mitchell Hashimoto f2e7f505d4 terraform: subpath context setting 2015-05-01 14:19:32 -07:00
Mitchell Hashimoto 9a54dddc85 terraform: eval for variables 2015-05-01 14:10:41 -07:00
Mitchell Hashimoto e544e1d401 terraform: hook up the proxies 2015-05-01 11:45:42 -07:00
Mitchell Hashimoto 7d28e980a5 terraform: proxy uses custom edge 2015-05-01 11:41:01 -07:00
Mitchell Hashimoto f24a1533f2 terraform: GraphNodeProxy 2015-05-01 11:38:36 -07:00
Mitchell Hashimoto a0d9bc0f19 terraform: outputs connect properly 2015-05-01 11:26:58 -07:00
Mitchell Hashimoto 7e838dfae2 terraform: Graph should overrride Remove to clear lookaside 2015-05-01 11:20:57 -07:00
Mitchell Hashimoto dd14ce9a0b terraform: test that variable deps reach out to parent graph 2015-05-01 11:09:23 -07:00
Mitchell Hashimoto e542d6efdf terraform: test to verify config variables are variables 2015-05-01 10:56:46 -07:00