Commit Graph

1522 Commits

Author SHA1 Message Date
James Bardin
6f347ebb3a Remove dot package
Unify all dot functionality in the dag package
2016-11-14 08:50:34 -05:00
James Bardin
8a5d71b0ac Implement dag.GraphNodeDotter (temporarily)
To maintain the same output, the Graph.Dot implementation needs to be
aware of GraphNodeDotter. Copy the interface into the dag package, and
make the Dot marshaler aware of which nodes implemented the interface.
This way we can remove most of the remaining dot code from terraform.
2016-11-14 08:50:34 -05:00
James Bardin
7b774f771b implement dag.Subgrapher interface
This allows the dag package to detect subgraphs, even when impelemnted
by types from other packages
2016-11-14 08:50:34 -05:00
James Bardin
28d406c040 Provider a marshaler for dag.Graph
The dot format generation was done with a mix of code from the terraform
package and the dot package. Unify the dot generation code, and it into
the dag package.

Use an intermediate structure to allow a dag.Graph to marshal itself
directly. This structure will be ablt to marshal directly to JSON, or be
translated to dot format. This was we can record more information about
the graph in the debug logs, and provide a way to translate those logged
structures to dot, which is convenient for viewing the graphs.
2016-11-14 08:50:33 -05:00
Mitchell Hashimoto
8d993d9edd release: clean up after v0.8.0-beta1 2016-11-11 22:08:27 +00:00
Mitchell Hashimoto
1889aee292 v0.8.0-beta1 2016-11-11 22:03:16 +00:00
Mitchell Hashimoto
26490f71a7 Merge pull request #10037 from hashicorp/f-default-graph
terraform: default new graphs on, old graphs behind -Xlegacy-graph
2016-11-11 11:34:58 -08:00
Mitchell Hashimoto
f5da7e85c8
terraform: detect compute counts and show a nicer error
This will detect computed counts (which we don't currently support) and
change the error to be more informative that we don't allow computed
counts. Prior to this, the error would instead be something like
`strconv.ParseInt: "${var.foo}" cannot be parsed as int`.
2016-11-11 11:07:17 -08:00
Mitchell Hashimoto
785cc7b78a
terraform: default new graphs on, old graphs behind -Xlegacy-graph
This turns the new graphs on by default and puts the old graphs behind a
flag `-Xlegacy-graph`. This effectively inverts the current 0.7.x
behavior with the new graphs.

We've incubated most of these for a few weeks now. We've found issues
and we've fixed them and we've been using these graphs internally for
awhile without any major issue. Its time to default them on and get them
part of a beta.
2016-11-10 21:53:20 -08:00
Mitchell Hashimoto
3b86dff9a2 Merge pull request #10036 from hashicorp/b-destroy-order
terraform: destroy graph must connect edges for proper target ordering
2016-11-10 21:49:55 -08:00
Mitchell Hashimoto
2cef1e5fd5
terraform: really simple error message fix, direct to master 2016-11-10 21:31:38 -08:00
Mitchell Hashimoto
b68b95dad0
terraform: destroy graph must connect edges for proper target ordering
This connects the destroy edges so that when a `-target` is specified on
a destroy, the proper dependencies get destroyed as well.
2016-11-10 21:14:44 -08:00
Mitchell Hashimoto
89919b605b
terraform: make sure all interpolation variables pass through hil 2016-11-10 20:23:28 -08:00
Mitchell Hashimoto
5643a7c28b
terraform: when returning a raw attribute value, use hil conversion
Because we now rely on HIL to do the computed calculation, we must make
sure the type is correct (TypeUnknown). Before, we'd just check for the
UUID in the string.

This changes all variable returns in the interpolater to run it through
`hil.InterfaceToVariable` which handles this lookup for us.
2016-11-10 17:16:45 -08:00
Mitchell Hashimoto
ec0ef95c6f
terraform: verify import providers only depend on vars 2016-11-09 15:09:13 -08:00
Mitchell Hashimoto
ec6e14c4d0
terraform: convert import graph to use new provider nodes
This uses the new NodeApplyableProvider graph nodes. This will just make
it easier for us in the future to adopt new graph transforms by starting
to use the new ones here.
2016-11-09 15:09:13 -08:00
Mitchell Hashimoto
2be756642f
terraform: the import RootTransformer should run last
This was causing multiple root issues
2016-11-09 15:08:22 -08:00
Mitchell Hashimoto
2b72882405
terraform: import loads the context module by default
This allows it to load provider configuration and interpolate it rather
than it coming purely from the environment.
2016-11-09 15:08:22 -08:00
Mitchell Hashimoto
9b5b122f14
terraform: ResourceConfig reimplementation for TypeUnknown
The primary change here is to expect that Config contains computed
values. This introduces `unknownCheckWalker` that does a really basic
reflectwalk to look for computed values and use that for IsComputed.

We had a weird mixture before checking whether c.Config was simply
missing values to determine where to look. Now we rely on IsComputed
heavily.
2016-11-09 14:28:16 -08:00
Mitchell Hashimoto
29485f6167
terraform: ResourceConfig.IsComputed cases 2016-11-09 14:28:15 -08:00
Mitchell Hashimoto
0c271b2b2d
terraform: better detection of unknown values in ResourceConfig, tests 2016-11-09 14:28:15 -08:00
Mitchell Hashimoto
9cc5e81a6c
terraform: add tests for IsComputed that pass on master 2016-11-09 14:28:15 -08:00
Mitchell Hashimoto
5ed1b5fc89
terraform: use the new TypeUnknown type from HIL
This makes all the computed stuff "just work" since HIL uses the same
computed sentinel value (string UUID) and the type differentiates it
from a regular string.
2016-11-09 14:28:15 -08:00
James Bardin
f7d6fb368a
Add failing test for missing computed map entries
The map output from the module "mod" loses the computed value from the
template when we validate. If the "extra" field is removed from the map,
the validation fails earlier with map "does not have any elements so
cannot determine type".

Apply will work, because the computed value will exist in the map.
2016-11-09 14:28:15 -08:00
Mitchell Hashimoto
66ccc19d94 Merge pull request #9973 from hashicorp/f-new-plan
terraform: new plan graph
2016-11-09 08:15:40 -08:00
Mitchell Hashimoto
fa195d4faf
terraform: fix a typo found during review 2016-11-09 08:10:09 -08:00
Mitchell Hashimoto
9e0af96afa Merge pull request #9971 from hashicorp/b-orphan-output
terraform: prune orphan outputs in old graph
2016-11-09 07:53:15 -08:00
Mitchell Hashimoto
2b7177cfe7 Merge pull request #9607 from hashicorp/f-provider-stop-redo
terraform: ResourceProvider.Stop (redo)
2016-11-08 15:58:48 -08:00
Mitchell Hashimoto
261f0ee592 Merge pull request #9698 from hashicorp/b-simple-var
terraform: disallow simple variables ("foo")
2016-11-08 15:30:31 -08:00
Mitchell Hashimoto
838fe2af9b
terraform: address go vet 2016-11-08 14:04:57 -08:00
Mitchell Hashimoto
bcc67fd135
terraform: uncomment a test that we were waiting on
terraform: remove final TODO
2016-11-08 13:59:31 -08:00
Mitchell Hashimoto
19350d617d
terraform: references can have backups
terraform: more specific resource references

terraform: outputs need to know about the new reference format

terraform: resources w/o a config still have a referencable name
2016-11-08 13:59:30 -08:00
Mitchell Hashimoto
c0d2493156
terraform: remove a complete TODO 2016-11-08 13:59:30 -08:00
Mitchell Hashimoto
337abe3f62
terraform: enable plan shadow graph 2016-11-08 13:59:30 -08:00
Mitchell Hashimoto
1efdba9b30
terraform: target at the right moment to get the right values 2016-11-08 13:59:30 -08:00
Mitchell Hashimoto
bb9820cc0b
terraform: enable targeting on expanded nodes 2016-11-08 13:59:29 -08:00
Mitchell Hashimoto
d29844969a
terraform: test fixture needs to use variable so its not pruned 2016-11-08 13:59:29 -08:00
Mitchell Hashimoto
f6df1edeb4
terraform: proper "what to orphan" on zero/one boundary logic 2016-11-08 13:59:29 -08:00
Mitchell Hashimoto
f95f904ba8
terraform: add TargetsTransformer to plan 2016-11-08 13:59:29 -08:00
Mitchell Hashimoto
a2d71388c2
terraform: output the exact instance for prevent destroy on count 2016-11-08 13:59:28 -08:00
Mitchell Hashimoto
e6be4fefe8
terraform: reference an output so it isn't pruned during plan 2016-11-08 13:59:28 -08:00
Mitchell Hashimoto
6914d605c8
terraform: connect references 2016-11-08 13:59:28 -08:00
Mitchell Hashimoto
091264e4ba
terraform: OrphanResourceCountTransformer for orphaning extranneous
instances
2016-11-08 13:59:27 -08:00
Mitchell Hashimoto
97b7915b8f
terraform: fix zero/one boundary for resource counts 2016-11-08 13:59:27 -08:00
Mitchell Hashimoto
bd8802e08d
terraform: plan orphan destruction 2016-11-08 13:59:27 -08:00
Mitchell Hashimoto
2608c5f282
terraform: transform for adding orphan resources + tests 2016-11-08 13:59:27 -08:00
Mitchell Hashimoto
6337829786
terraform: expand count in plan 2016-11-08 13:59:26 -08:00
Mitchell Hashimoto
4cdaf6f687
terraform: ResourceTransformer to ResourceTransformerOld 2016-11-08 13:59:26 -08:00
Mitchell Hashimoto
d7aa59be3c
terraform: begin NodePlannableResource 2016-11-08 13:59:26 -08:00
Mitchell Hashimoto
dbac0785bc
terraform: tests for the plan graph builder 2016-11-08 13:59:26 -08:00