Commit Graph

1722 Commits

Author SHA1 Message Date
Mitchell Hashimoto
bbae22007d Merge pull request #11921 from hashicorp/b-untarget-output
terraform: outputs should not be included if not targeted
2017-02-15 10:47:14 -08:00
Mitchell Hashimoto
c36b6c42ba terraform: test case for #10982 (passes) 2017-02-13 13:06:22 -08:00
Mitchell Hashimoto
4d6085b46a terraform: outputs should not be included if not targeted
Fixes #10911

Outputs that aren't targeted shouldn't be included in the graph.

This requires passing targets to the apply graph. This is unfortunate
but long term should be removable since I'd like to move output changes
to the diff as well.
2017-02-13 12:52:45 -08:00
James Bardin
92cea2478d Add test for nil *os.File in ReadState 2017-02-09 16:06:07 -05:00
James Bardin
0c1b138719 Add state locking during backend init
During backend initialization, especially during a migration, there is a
chance that an existing state could be overwritten.

Attempt to get a locks when writing the new state. It would be nice to
always have a lock when reading the states, but the recursive structure
of the Meta.Backend config functions makes that quite complex.
2017-02-09 15:47:27 -05:00
Mitchell Hashimoto
8ed9bdfedc terraform: node referenceable name from state shuldn't contain path
Fixes #11749

I'm **really** surprised this didn't come up earlier.

When only the state is available for a node, the advertised
referenceable name (the name used for dependency connections) included
the module path. This module path is automatically prepended to the
name. This means that probably every non-root resource for state-only
operations (destroys) didn't order properly.

This fixes that by omitting the path properly.

Multiple tests added to verify both graph correctness as well as a
higher level context test.

Will backport to 0.8.x
2017-02-07 20:14:38 -08:00
Mitchell Hashimoto
af61d566c2 terraform: passing test for destroy edge for module only
Just adding passing tests as a sanity check for a bug.
2017-02-07 19:12:03 -08:00
Mitchell Hashimoto
ac3d67e40f terraform: remove old logging line 2017-02-07 16:28:01 -08:00
Mitchell Hashimoto
7192c1a9a1 Merge pull request #11732 from hashicorp/b-diff-map-removal
terraform: ignore RequiresNew for collection removal in diff.Same
2017-02-07 12:58:15 -08:00
Mitchell Hashimoto
e7aa1fd48d Merge pull request #11733 from hashicorp/b-disable-shadow
terraform: default shadow to false
2017-02-07 12:57:46 -08:00
Mitchell Hashimoto
ac934cf003 terraform: add one more forgotten ordering assertion 2017-02-07 12:01:27 -08:00
Mitchell Hashimoto
a765740827 terraform: CBD destroy nodes should not advertise themselves as normal 2017-02-07 11:49:50 -08:00
Mitchell Hashimoto
44233441c2 terraform: CBD edge should ignore "index" 2017-02-07 10:53:12 -08:00
Mitchell Hashimoto
864c79396d terraform: default shadow to false
To avoid chasing down issues like #11635 I'm proposing we disable the
shadow graph for end users now that we have merged in all the new
graphs. I've kept it around and default-on for tests so that we can use
it to test new features as we build them. I think it'll still have value
going forward but I don't want to hold us for making it work 100% with
all of Terraform at all times.

I propose backporting this to 0-8-stable, too.
2017-02-06 18:02:32 -08:00
Mitchell Hashimoto
fe32f7b189 terraform: ignore RequiresNew for collection removal in diff.Same
Fixes #11349

I tracked this bug back to the early 0.7 days so this has been around a
really long time. I wanted to confirm that this wasn't introduced by any
new graph changes and it appears to predate all of that. I couldn't find
a single 0.7.x release where this worked, and I didn't want to go back
to 0.6.x since it was pre-vendoring.

The test case shows the logic the best, but the basic idea is: for
collections that go to zero elements, the "RequiresNew" sameness check
should be ignored, since the new diff can choose to not have that at all
in the diff.
2017-02-06 17:46:48 -08:00
Mitchell Hashimoto
ebb129f051 terraform: data source on refresh should just delete from state
This was caught by an acceptance test. We've now added a unit test. When
refreshing, an orphan (no config) data source should just be deleted.
2017-02-03 20:58:03 +01:00
Mitchell Hashimoto
1777f53a4b Merge pull request #11660 from hashicorp/f-graph-deps
terraform: remove ConnectDependents and related interfaces
2017-02-03 14:52:07 +01:00
Mitchell Hashimoto
755cef98b0 terraform: remove ConnectDependents and related interfaces 2017-02-03 14:25:54 +01:00
James Bardin
9acb86a182 Merge pull request #11187 from hashicorp/jbardin/state-locking
State Locking initial implementations
2017-02-01 14:35:55 -05:00
Mitchell Hashimoto
068b2b2dec terraform: add Meta field to diffs
This adds a Meta field (similar to InstanceState.Meta) to InstanceDiff.

This allows providers to store arbitrary k/v data as part of a diff and
have it persist through to the Apply. This will be used by helper/schema
for timeout storage being done by @catsby.

The type here is `map[string]interface{}`. A couple notes:

  * **Not using `string`**: The Meta field of InstanceState is a string
    value. We've learned that forcing things to strings is bad. Let's
    just allow types.

  * **Primitives only**: Even though it is type `interface{}`, it must
    be able to cleanly pass the go-plugin RPC barrier as well as be
    encoded to a file as Gob. Given these constraints, the value must
    only comprise of primitive types and collections. No structs,
    functions, channels, etc.
2017-01-31 11:50:37 -08:00
James Bardin
f20485550a Check for no state from the io.Reader
Read state would assume that having a reader meant there should be a
valid state. Check for an empty file and return ErrNoState to
differentiate a bad file from an empty one.
2017-01-30 17:16:57 -05:00
Mitchell Hashimoto
61881d2795 Merge pull request #10934 from hashicorp/f-provisioner-stop
core: stoppable provisioners, helper/schema for provisioners
2017-01-30 12:53:15 -08:00
Mitchell Hashimoto
3e771a674c terraform: acquire stopCh outside goroutine to ensure in lock 2017-01-30 08:49:07 -08:00
Mitchell Hashimoto
195d34424e Merge pull request #11482 from hashicorp/f-computed-count
core: allow non-computed data source values in "count"
2017-01-30 08:44:27 -08:00
Mitchell Hashimoto
00232f0994 terraform: acquireRun during test to avoid special case logic 2017-01-30 08:41:38 -08:00
Mitchell Hashimoto
5b42781117 terraform: defer unlock of lock in Stop to enure it always unlocks 2017-01-30 08:35:10 -08:00
Mitchell Hashimoto
9183be4c83 update master version to 0.9.0-dev 2017-01-29 18:46:18 -08:00
Mitchell Hashimoto
cf46e1c3e0 terraform: don't validate computed values in validate
This disables the computed value check for `count` during the validation
pass. This enables partial support for #3888 or #1497: as long as the
value is non-computed during the plan, complex values will work in
counts.

**Notably, this allows data source values to be present in counts!**

The "count" value can be disabled during validation safely because we
can treat it as if any field that uses `count.index` is computed for
validation. We then validate a single instance (as if `count = 1`) just
to make sure all required fields are set.
2017-01-27 21:15:43 -08:00
Mitchell Hashimoto
0ba3fcdc63 terraform: test static var being passed into grandchild for count 2017-01-27 20:38:07 -08:00
Mitchell Hashimoto
2162d6cf3d terraform: test a basic static var count passed into a module 2017-01-27 20:32:55 -08:00
Mitchell Hashimoto
dd6d025dbb terraform: commmit generated file 2017-01-27 20:31:29 -08:00
Mitchell Hashimoto
2beb62c92b terraform: remove flatten, forever 2017-01-26 21:03:27 -08:00
Mitchell Hashimoto
6d731b3b46 terraform: new provisioner node 2017-01-26 21:02:55 -08:00
Mitchell Hashimoto
e89d738679 terraform: provider transform is converted to new graph world view 2017-01-26 20:58:22 -08:00
Mitchell Hashimoto
91c9c6032f terraform: remove the old resource node 2017-01-26 20:48:05 -08:00
Mitchell Hashimoto
d59725e9fd terraform: convert StateDeps to use new structs 2017-01-26 20:47:20 -08:00
Mitchell Hashimoto
c1e4bd7b72 terraform: remove graph config node file 2017-01-26 20:16:06 -08:00
Mitchell Hashimoto
348cfa0ed7 terraform: remove graph annotations 2017-01-26 20:13:42 -08:00
Mitchell Hashimoto
a561934f61 terraform: keep pruning out lines 2017-01-26 20:12:01 -08:00
Mitchell Hashimoto
6c266d6ce3 terraform: prune down the resource node struct quite a bit 2017-01-26 20:08:55 -08:00
Mitchell Hashimoto
a6bab455cc terraform: remove node module file 2017-01-26 20:05:42 -08:00
Mitchell Hashimoto
37294d5ad2 terraform: remove old variable node 2017-01-26 20:04:39 -08:00
Mitchell Hashimoto
513ff88859 terraform: remove GraphConfigNodeType 2017-01-26 20:03:29 -08:00
Mitchell Hashimoto
31c813fa51 terraform: remove GraphNodeModule 2017-01-26 20:01:39 -08:00
Mitchell Hashimoto
3a97cf2df9 terraform: goodbye GraphNodeConfigProvider 2017-01-26 19:59:25 -08:00
Mitchell Hashimoto
0039f70d06 terraform: remove config transformer old 2017-01-26 19:57:46 -08:00
Mitchell Hashimoto
9086e996d6 terraform: convert all tests to use the new config transformer 2017-01-26 19:56:16 -08:00
Mitchell Hashimoto
efc79d431e terraform: more dead code removal 2017-01-26 19:47:02 -08:00
Mitchell Hashimoto
522a28ab95 terraform: convert root transform test to use new config transform 2017-01-26 19:40:46 -08:00
Mitchell Hashimoto
83e093a73e terraform: delete destroy interfaces 2017-01-26 19:39:24 -08:00