Commit Graph

990 Commits

Author SHA1 Message Date
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
Paul Hinze
48b172aa86 core: treat refs to unknown set resource attrs as unknown
References to computed list-ish attributes (set, list, map) were being
improperly resolved as an empty list `[]` during the plan phase (when
the value of the reference is not yet known) instead of as an
UnknownValue.

A "diffs didn't match" failure in an AWS DirectoryServices test led to
this discovery (and this commit fixes the failing test):

https://travis-ci.org/hashicorp/terraform/jobs/104812951

Refs #2157 which has the original work to support computed list
attributes at all. This is just a simple tweak to that work.

/cc @radeksimko
2016-01-26 13:50:44 -06:00
James Nugent
cb6cb8b96a core: Support explicit variable type declaration
This commit adds support for declaring variable types in Terraform
configuration. Historically, the type has been inferred from the default
value, defaulting to string if no default was supplied. This has caused
users to devise workarounds if they wanted to declare a map but provide
values from a .tfvars file (for example).

The new syntax adds the "type" key to variable blocks:

```
variable "i_am_a_string" {
    type = "string"
}

variable "i_am_a_map" {
    type = "map"
}
```

This commit does _not_ extend the type system to include bools, integers
or floats - the only two types available are maps and strings.

Validation is performed if a default value is provided in order to
ensure that the default value type matches the declared type.

In the case that a type is not declared, the old logic is used for
determining the type. This allows backwards compatiblity with previous
Terraform configuration.
2016-01-24 11:40:02 -06:00
Paul Hinze
8d8b28717e Merge pull request #4574 from hashicorp/phinze/orphan-addressing
Orphan addressing / targeting
2016-01-21 15:07:41 -06:00
Paul Hinze
545aaf1864 core: demote evaltree loglevel from INFO -> TRACE
One small step in the long road to making our log levels actually
useful. :)
2016-01-21 10:20:53 -06:00
Paul Hinze
7d10d454e2 Merge pull request #4749 from hashicorp/b-1752
core: fix diff mismatch when RequiresNew field and list both change
2016-01-19 18:29:10 -06:00
Paul Hinze
a0d3245ee3 core: Orphan addressing / targeting
Instead of trying to skip non-targeted orphans as they are added to
the graph in OrphanTransformer, remove knowledge of targeting from
OrphanTransformer and instead make the orphan resource nodes properly
addressable.

That allows us to use existing logic in TargetTransformer to filter out
the nodes appropriately. This does require adding TargetTransformer to the
list of transforms that run during DynamicExpand so that targeting can
be applied to nodes with expanded counts.

Fixes #4515
Fixes #2538
Fixes #4462
2016-01-19 17:48:44 -06:00
Paul Hinze
4af2c5f5dd core: fix diff mismatch when RequiresNew field and list both change
fixes #1752

Includes AccTest reproducing example from the issue as well as a bunch
of explanatory comments in the tests and impls.
2016-01-19 15:38:04 -06:00
Mitchell Hashimoto
54de9057ba terraform: failing test case 2016-01-19 12:37:55 -08:00
Clint
f9113ad40e release: clean up after v0.6.9 2016-01-08 19:03:25 +00:00
Clint
fd1c2697a4
v0.6.9 2016-01-08 17:43:57 +00:00
Paul Hinze
f80655b1ce release: clean up after v0.6.8 2015-12-02 15:32:07 +00:00
Paul Hinze
f1f214f03d
v0.6.8 2015-12-02 15:06:55 +00:00
Paul Hinze
0e277a6714 core: test coverage around map key regression
tests to cover the HCL-level issue fixed in
https://github.com/hashicorp/hcl/pull/65
2015-11-24 16:00:02 -06:00
clint shryock
73e1f4ce52 release: clean up after v0.6.7 2015-11-23 15:46:11 -06:00
clint shryock
b7c41aed92
v0.6.7 2015-11-23 18:16:01 +00:00
Paul Hinze
993ec0a320 Merge pull request #3909 from hashicorp/phinze/template-file-contents
template_file: source contents instead of path
2015-11-16 14:50:45 -06:00
James Nugent
38bb9f2416 Allow targeting of orphan nodes
Fixes #3852. We now run the OrphanTransformer even when targeting, and
pass it the list of targets following resource expansion.
2015-11-13 14:33:58 -06:00