Commit Graph

1007 Commits

Author SHA1 Message Date
James Nugent 91c644f194 release: clean up after v0.6.15 2016-04-22 19:06:05 +00:00
James Nugent 0c5c54e7b6
v0.6.15 2016-04-22 18:29:43 +00:00
James Nugent 31cc2d2ccd core: Do not type check unset variables
A consequnce of the work done in #6185 was that variables which were in
a module but not set explicitly (i.e. the default value was relied upon)
were marked as type errors. This was reported in #6230.

This commit adds a test case for this and a patch which fixes the issue.
2016-04-21 23:30:34 -05:00
Paul Hinze ddf794b7f7 core: fix provider config inheritence for deeply nested modules (#6186)
The flattening process was not properly drawing dependencies between provider
nodes in modules and their parent provider nodes.

Fixes #2832
Fixes #4443
Fixes #4865
2016-04-18 16:19:43 -07:00
James Nugent d7d39702c0 Type check variables between modules (#6185)
These tests demonstrates a problem where the types to a module input are 
not checked. For example, if a module - inner - defines a variable
"should_be_a_map" as a map, or with a default variable of map, we do not
fail if the user sets the variable value in the outer module to a string
value. This is also a problem in nested modules.

The implementation changes add a type checking step into the graph
evaluation process to ensure invalid types are not passed.
2016-04-15 12:07:54 -07:00
James Nugent 0d289f982c core: Print node types in traces
This makes it clearer when looking at  output as to which types of node
are involved in a particular graph.
2016-04-13 10:20:18 -07:00
Paul Hinze d992f8d52d core: Remove module input transformer
The nodes it adds were immediately skipped by flattening and therefore
never had any effect. That makes the transformer effectively dead code
and removable. This was the only usage of FlattenSkip so we can remove
that as well.
2016-04-13 11:15:24 -05:00
Paul Hinze 9b01acd829 release: clean up after v0.6.14 2016-03-22 00:26:11 +00:00
Paul Hinze c7e5b24531
v0.6.14 2016-03-21 23:57:35 +00:00
Paul Hinze 024dcc9d32 terraform: share graph walker's variables lock w/ interpolater
The ContextGraphWalker struct includes a lock that's passed down to
BuiltinEvalContext and guards access to interpolation variables as
they're written using SetVariables.

The likely problem being expressed in #5733 is that the same map
reference is also passed down to the Interpolater.Variables field, which
is used for variable lookup.

Here, we plumb the same lock we're using to guard access for writes down
and acquire it before doing variable reads as well. It's not as fine
grained as perhaps it could be, but all the context tests pass and I
believe this should address #5733.
2016-03-21 18:21:44 -05:00
Paul Hinze f480ae3430 core: Fix issues with ignore_changes
The ignore_changes diff filter was stripping out attributes on Create
but the diff was still making it down to the provider, so Create would
end up missing attributes, causing a full failure if any required
attributes were being ignored.

In addition, any changes that required a replacement of the resource
were causing problems with `ignore_chages`, which didn't properly filter
out the replacement when the triggering attributes were filtered out.

Refs #5627
2016-03-21 14:20:36 -05:00
James Nugent b25f2091e6 release: clean up after v0.6.13 2016-03-16 11:53:29 +00:00
James Nugent 1f627a8a0b
v0.6.13 2016-03-16 11:03:08 +00:00
Paul Hinze 57070057db Merge pull request #5527 from hashicorp/phinze/untaint
command: Add `terraform untaint`
2016-03-14 09:34:43 -05:00
Paul Hinze c7f5450a96 command: Add `terraform untaint`
- [x] Docs
 - [x] Command Unit Tests
 - [x] State Unit Tests

Closes #4820
2016-03-11 12:38:57 -06:00
Paul Hinze f882dd1427 core: Encode Targets in saved Planfile
When a user specifies `-target`s on a `terraform plan` and stores
the resulting diff in a plan file using `-out` - it usually works just
fine since the diff is scoped based on the targets.

When there are tainted resources in the state, however, graph nodes to
destroy them were popping back into the plan when it was being loaded
from a file. This was because Targets weren't being stored in the
Planfile, so Terraform didn't know to filter them out. (In the
non-Planfile scenario, we still had the Targets loaded directly from the
flags.)

By encoding Targets in with the Planfile we can ensure that the same
filters are always applied.

Backwards compatibility should be fine here, since we're just adding a
field. The gob encoder/decoder will just do the right thing (ignore/skip
the field) with planfiles stored w/ versions that don't know about
Targets.

Fixes #5183
2016-03-08 14:29:37 -06:00
Paul Hinze 5d9637ab1a core: Clean up test for issue #5254 2016-03-08 14:28:18 -06:00
Paul Hinze 2a97e53b24 release: clean up after v0.6.12 2016-02-24 20:33:57 +00:00
Paul Hinze 9556c4dfab
v0.6.12 2016-02-24 19:58:28 +00:00
James Nugent 242f088309 Merge pull request #5302 from hashicorp/b-5254
terraform: don't prune resource if count has interpolations
2016-02-24 12:17:35 -05:00
Mitchell Hashimoto 12b6776675 terraform: don't prune resource if count contains interpolations 2016-02-24 12:04:42 -05:00
Mitchell Hashimoto 54411301c4 terraform: println so we show up in logs 2016-02-24 11:57:27 -05:00
Paul Hinze b7554ced1d terraform: repro for issue 5254 test 2016-02-24 10:04:57 -06:00
Paul Hinze 6af79168db core: demote early exit log from ERROR -> DEBUG 2016-02-24 09:58:33 -06:00
Mitchell Hashimoto 4eed21f04c terraform: issue 5254 test case (not yet working) 2016-02-24 10:55:55 -05:00
Paul Hinze 8472c7d59f core: log eval tree operations 2016-02-24 09:49:11 -06:00
Paul Hinze b831ba3ab6 terraform: tweak diffs didn't match output spacing
Use four-space indent to catch `<pre>` formatting on GitHub for users
who copy/paste.
2016-02-23 14:35:30 -06:00
Paul Hinze dabb8a3511 Merge pull request #5276 from hashicorp/phinze/diffs-didnt-matchs-output
core: output "diffs didn't match" error details
2016-02-23 14:07:23 -06:00
Paul Hinze 78f5780248 core: output "diffs didn't match" error details
Previously these details were relegated to the debug logs, which forces
the user to reproduce the error condition and then go digging for the
error message. Since we're asking users to report this error, let's give
them all the details they need right up front to make it a little easier
on them.
2016-02-23 13:41:18 -06:00
Paul Hinze fbc9cf9ddb core: error instead of panic on self var in wrong scope
Fixes #4808
Fixes #5174
2016-02-23 11:44:24 -06:00
Paul Hinze 5a9dad82d6 terraform: upgrade resource name regexp failure to error
We're well past Terraform 0.4, so it's time to finally make good on the
original promise. :)

Fixes #5243
2016-02-23 10:32:49 -06:00
Paul Hinze 136c228b48 core: add context test for #5096 2016-02-22 18:37:21 -06:00
Paul Hinze 3d2bd8576a Merge pull request #5096 from paybyphone/paybyphone_create_before_destroy_bypass
Bypass CreateBeforeDestroyTransformer on terraform destroy
2016-02-22 18:34:36 -06:00
James Nugent bc6107508d Fix additional vet warnings 2016-02-17 11:59:50 -08:00
Chris Marchesi 4a22ac5ea0 Bypass CreateBeforeDestroyTransformer during terraform destroy 2016-02-10 20:08:36 -08:00
Paul Hinze 9a00675262 Merge pull request #5026 from hashicorp/phinze/destroy-node-copies
core: Make copies when creating destroy nodes
2016-02-09 11:12:01 -06:00
Paul Hinze 4c123dbf96 Merge pull request #5022 from hashicorp/phinze/fix-provider-double-init-for-nested-module-orphans
core: fix bug detecting deeply nested module orphans
2016-02-09 11:02:37 -06:00
Paul Hinze e76fdb92e7 core: fix bug detecting deeply nested module orphans
Context:

As part of building up a Plan, Terraform needs to detect "orphaned"
resources--resources which are present in the state but not in the
config. This happens when config for those resources is removed by the
user, making it Terraform's responsibility to destroy them.

Both state and config are organized by Module into a logical tree, so
the process of finding orphans involves checking for orphaned Resources
in the current module and for orphaned Modules, which themselves will
have all their Resources marked as orphans.

Bug:

In #3114 a problem was exposed where, given a module tree that looked
like this:

```
root
 |
 +-- parent (empty, except for sub-modules)
       |
       +-- child1 (1 resource)
       |
       +-- child2 (1 resource)
```

If `parent` was removed, a bunch of error messages would occur during
the plan. The root cause of this was duplicate orphans appearing for the
resources in child1 and child2.

Fix:

This turned out to be a bug in orphaned module detection. When looking
for deeply nested orphaned modules, root.parent was getting added twice
as an orphaned module to the graph.

Here, we add an additional check to prevent a double add, which
addresses this scenario properly.

Fixes #3114 (the Provisioner side of it was fixed in #4877)
2016-02-09 10:35:46 -06:00
Paul Hinze 3f72837f4b core: Make copies when creating destroy nodes
Fixes an interpolation race that was occurring when a tainted destroy
node and a primary destroy node both tried to interpolate a computed
count in their config. Since they were sharing a pointer to the _same_
config, depending on how the race played out one of them could catch the
config uninterpolated and would then throw a syntax error.

The `Copy()` tree implemented for this fix can probably be used
elsewhere - basically we should copy the config whenever we drop nodes
into the graph - but for now I'm just applying it to the place that
fixes this bug.

Fixes #4982 - Includes a test covering that race condition.
2016-02-09 09:25:16 -06:00
Sander van Harmelen f6822dcb7d Merge pull request #4999 from svanharmelen/f-rename-missing-provider-node
Rename `graphNodeMissingProvider` to `graphNodeProvider`
2016-02-08 20:32:03 +01:00
Paul Hinze 0846e32e21 Merge pull request #4877 from svanharmelen/b-provisioner-graphing
core: fix the provisioner graphing
2016-02-05 12:39:19 -06:00
Sander van Harmelen e938a645c5 Rename `graphNodeMissingProvider` to `graphNodeProvider`
It seems `graphNodeProvider` is a more descriptive name for this node…
2016-02-04 21:41:04 +01: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 8be4afacf8 terraform: replace config/lang usage 2016-02-03 13:24:04 -05:00
David Harris d95ab75565 Added EvalIgnoreChanges on diffApply. 2016-02-02 15:23:25 -07:00
clint dce2994151 release: clean up after v0.6.11 2016-02-01 20:17:08 +00:00
clint 3590cfadb0
v0.6.11 2016-02-01 19:16:01 +00:00
Sander van Harmelen 5c3da47d8e Fix the provisioner graphing
Without this change, all provisioners are added to the graph by default
and they are never pruned from the graph if their not needed.
2016-01-28 16:14:15 +01:00
Paul Hinze 2dca1ea9a0 release: clean up after v0.6.10 2016-01-27 17:01:41 -06:00
Paul Hinze 22481b06f5
v0.6.10 2016-01-27 22:18:55 +00:00