Commit Graph

21 Commits

Author SHA1 Message Date
Martin Atkins
4a21b763aa core: Get tests compiling again
After the refactoring to integrate HCL2 many of the tests were no longer
using correct types, attribute names, etc.

This is a bulk update of all of the tests to make them compile again, with
minimal changes otherwise. Although the tests now compile, many of them
do not yet pass. The tests will be gradually repaired in subsequent
commits, as we continue to complete the refactoring and retrofit work.
2018-10-16 18:46:46 -07:00
Mitchell Hashimoto
09242fab09
terraform: remove legacy graph builder 2017-01-26 15:18:42 -08: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
d97b24e3c1
Add tests and fix last issues 2016-05-26 19:56:03 -05:00
Chris Marchesi
4a22ac5ea0 Bypass CreateBeforeDestroyTransformer during terraform destroy 2016-02-10 20:08:36 -08:00
Sander van Harmelen
1bec11472a Cleaning up the PruneProvisionerTransformer
And renamed some types so they better reflect what they are for.
2016-02-04 21:32:10 +01:00
Mitchell Hashimoto
7031cb145c terraform: orphan dependencies should be inverted 2015-06-23 20:41:02 -07: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
Mitchell Hashimoto
7c3e355bb0 terraform: flattening multi-level modules works 2015-05-07 13:08:59 -07:00
Paul Hinze
d4b9362518 core: validate on verbose graph to detect some cycles earlier
Most CBD-related cycles include destroy nodes, and destroy nodes were
all being pruned from the graph before staring the Validate walk.

In practice this meant that we had scenarios that would error out with
graph cycles on Apply that _seemed_ fine during Plan.

This introduces a Verbose option to the GraphBuilder that tells it to
generate a "worst-case" graph. Validate sets this to true so that cycle
errors will always trigger at this step if they're going to happen.

(This Verbose option will be exposed as a CLI flag to `terraform graph`
in a second incoming PR.)

refs #1651
2015-04-23 11:07:13 -05: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
865de51816 dag: do a DFS for each vertex 2015-02-27 19:37:59 -08:00
Mitchell Hashimoto
9eb7ebbddd terraform: do the transitive reduction as part of the graph builder 2015-02-27 19:23:20 -08:00
Mitchell Hashimoto
ad595cf254 terraform: test case for cycle of CBD depending on non-CBD 2015-02-19 12:08:33 -08:00
Mitchell Hashimoto
e68ea0d38f terraform: only keep the destroy if we decreased counts 2015-02-19 12:08:33 -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
Mitchell Hashimoto
d847b2b672 terraform: provider config inheritance in modules 2015-02-19 12:07:59 -08:00
Mitchell Hashimoto
cae6deb351 terraform: more tests 2015-02-19 12:07:57 -08:00
Mitchell Hashimoto
e2a3f78c08 terraform: expand modules in our builder 2015-02-19 12:07:57 -08:00
Mitchell Hashimoto
a73f939ee9 terraform: initial GraphBuilder impl 2015-02-19 12:07:54 -08:00