Commit Graph

26 Commits

Author SHA1 Message Date
Mitchell Hashimoto
afe5ec6e29 terraform: module orphans providers should inherit config 2015-06-24 17:48:31 -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
6b2e0b938d terraform: only omit vars on full destroys 2015-05-06 20:55:14 -07:00
Mitchell Hashimoto
6afc14982a terraform: destroy transform must happen globally 2015-05-02 18:21:00 -07:00
Mitchell Hashimoto
86d07d3b5b terraform: redo how flattening works 2015-05-01 15:18:40 -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
873f5a91bb terraform: EvalDeleteOutput and context test 2015-04-29 11:27:12 -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
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
97acccd3ed core: targeted operations
Add `-target=resource` flag to core operations, allowing users to
target specific resources in their infrastructure. When `-target` is
used, the operation will only apply to that resource and its
dependencies.

The calculated dependencies are different depending on whether we're
running a normal operation or a `terraform destroy`.

Generally, "dependencies" refers to ancestors: resources falling
_before_ the target in the graph, because their changes are required to
accurately act on the target.

For destroys, "dependencies" are descendents: those resources which fall
_after_ the target. These resources depend on our target, which is going
to be destroyed, so they should also be destroyed.
2015-03-31 14:49:38 -05:00
Mitchell Hashimoto
80c129a961 terraform: style, multiline a long line 2015-03-02 08:41:09 -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
4789f16796 terraform: tainted destroy nodes 2015-02-19 12:08:33 -08:00
Mitchell Hashimoto
9c14315336 terraform: don't prune if there are known tainted resources 2015-02-19 12:08:33 -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
d7dc0291f5 terraform: put destroy nodes into the graph 2015-02-19 12:08:03 -08:00
Mitchell Hashimoto
d94c4392eb terraform: validate provisioners 2015-02-19 12:07:58 -08:00
Mitchell Hashimoto
ea42deb66c terraform: provisioner transforms 2015-02-19 12:07:58 -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
4692f9809f terraform: module nodes expand 2015-02-19 12:07:57 -08:00
Mitchell Hashimoto
c308405b53 terraform: validation in progress 2015-02-19 12:07:55 -08:00
Mitchell Hashimoto
a73f939ee9 terraform: initial GraphBuilder impl 2015-02-19 12:07:54 -08:00