Commit Graph

34 Commits

Author SHA1 Message Date
James Bardin 8d1e479fc7 don't ignore partial containers in diffs
Containers (maps, lists, sets) in an InstanceDiff need to be handled in
their entirety.  Unchanged values cannot be filtered out from diffs, as
providers expect attribute containers to be complete.

If a value in ignore_changes maps to a single key in an attribute
container, and there are other changes present, that ignored value must
be included in the diff as well.
2018-01-17 19:13:32 -05:00
Nathan Evans 45439d0ac3 Add inequality check to ignore redundant diff attributes 2017-11-28 10:11:19 -07:00
James Bardin 36b8be43e8 use the new version package
Update all references to the version values to use the new package.
The VersionString function was left in the terraform package
specifically for the aws provider, which is vendored. We can remove that
last call once the provider is updated.
2017-10-19 21:48:08 -04:00
Chris Marchesi 5654a676d9 core: Skip diff hooks for stubs on eval altogether
Rather than overloading InstanceDiff with a "Stub" attribute that is
going to be largely meaningless, we are just going to skip
pre/post-diff hooks altogether. This is under the notion that we will
eventually not need to "stub" a diff for scale-out, stateless nodes on
refresh at all, so diff behaviour won't be necessary at that point, so
we should not assume that hooks will run at this stage anyway.

Also as part of this removed the CountHook test that is now failing
because CountHook is out of scope of the new behaviour.
2017-06-24 08:01:17 -07:00
Chris Marchesi 45528b2217 core: Instance/EvalDiff.Quiet -> Stub
Changed the language of this field to indicate that this diff is not a
"real" diff, in that it should not be acted on, versus a "quiet" mode,
which would indicate just simply to act silently.
2017-06-21 09:15:08 -07:00
Chris Marchesi eef933f2a7 core: Don't count scaled-out resources twice in the UI
This fixes a bug with the new refresh graph behaviour where a resource
was being counted twice in the UI on part of being scaled out:

 * We are no longer transforming refresh nodes without state to
   plannable resources (the transformer will be removed shortly)
 * A Quiet flag has been added to EvalDiff and InstanceDiff - this
   allows for the flagging of a diff that should not be treated as real
   diff for purposes of planning
 * When there is no state for a refresh node now, a new path is taken
   that is similar to plan, but flags Quiet, and does nothing with the
   diff afterwards.

Tests pending - light testing has confirmed this should fix the double
count issue, but we should have some tests to actually confirm the bug.
2017-06-20 07:37:32 -07:00
James Bardin 0ae0076e3a Correctly filter flatmapped values in diff
When transforming a diff from DestroyCreate to a simple Update,
ignore_changes can cause keys from flatmapped objects to be filtered
form the diff. We need to filter each flatmapped container as a whole to
ensure that unchanged keys aren't lost in the update.
2017-03-21 09:11:54 -04:00
Mitchell Hashimoto 80457b689c
terraform: do the deposed check within EvalDiff
There is never any reason to separate the two.
2016-11-28 14:34:24 -08:00
Mitchell Hashimoto b72ef90c2f Revert "[WIP] core: Log diff mismatch using spew instead of %#v" 2016-11-15 11:53:28 -08:00
Mitchell Hashimoto b20f43834b Merge pull request #9118 from hashicorp/spew-diff-mismatch
[WIP] core: Log diff mismatch using spew instead of %#v
2016-11-15 11:53:19 -08:00
Mitchell Hashimoto f142978456
terraform: add test to verify tainted resources don't process
ignore_changes

For #7855
2016-10-27 08:44:59 -04:00
Mitchell Hashimoto 984cade39f
Merge branch 'fix-taint-w-ignorechanges' of https://github.com/sl1pm4t/terraform into sl1pm4t-fix-taint-w-ignorechanges 2016-10-27 08:32:37 -04:00
James Nugent 7dab27065f core: Log diff mismatch using spew instead of %#v
This commit improves the error logging for "Diffs do not match" errors
by using the go-spew library to ensure that the structures are presented
fully and in a consistent order. This allows use of the command line
diff tool to analyse what is wrong.
2016-09-29 14:45:46 -05:00
Sander van Harmelen 47dd1ad153 Add wildcard (match all) support to ignore_changes (#8599) 2016-09-02 15:44:35 +02:00
James Bardin 5802f76eaa Make all terraform package tests pass under -race
This isn't a pretty refactor, but fixes the race issues in this package
for now.

Fix race on RawConfig.Config()

fix command package races
2016-07-29 16:12:21 -04:00
Matt Morrison dbf04721d2 Tainted resource not recreated if ignore_changes used on any attributes. 2016-07-29 09:12:39 +12:00
Paul Hinze 14cea95e86
terraform: another set of ignore_changes fixes
This set of changes addresses two bug scenarios:

(1) When an ignored change canceled a resource replacement, any
downstream resources referencing computer attributes on that resource
would get "diffs didn't match" errors. This happened because the
`EvalDiff` implementation was calling `state.MergeDiff(diff)` on the
unfiltered diff. Generally this is what you want, so that downstream
references catch the "incoming" values. When there's a potential for the
diff to change, thought, this results in problems w/ references.

Here we solve this by doing away with the separate `EvalNode` for
`ignore_changes` processing and integrating it into `EvalDiff`. This
allows us to only call `MergeDiff` with the final, filtered diff.

(2) When a resource had an ignored change but was still being replaced
anyways, the diff was being improperly filtered. This would cause
problems during apply when not all attributes were available to perform
the replacement.

We solve that by deferring actual attribute removal until after we've
decided that we do not have to replace the resource.
2016-07-08 16:48:23 -05:00
Sander van Harmelen d97b24e3c1
Add tests and fix last issues 2016-05-26 19:56:03 -05:00
Sander van Harmelen 8560f50cbc
Change taint behaviour to act as a normal resource
This means it’s shown correctly in a plan and takes into account any
actions that are dependant on the tainted resource and, vice verse, any
actions that the tainted resource depends on.

So this changes the behaviour from saying this resource is tainted so
just forget about it and make sure it gets deleted in the background,
to saying I want that resource to be recreated (taking into account the
existing resource and it’s place in the graph).
2016-05-26 19:55:26 -05: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 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 d168cc1bd1 terraform: add reason to diff mismatch error
Helps with debugging those pesky "diffs did not match" errors.
2015-04-13 09:31:09 -05:00
Mitchell Hashimoto 6affc57b2d terraform: destroy node should not create 2015-02-24 22:45:47 -08:00
Mitchell Hashimoto b52881d232 terraform: clean up EvalNodes 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto 119d5a09cf terraform: fix some diff comparison 2015-02-19 12:08:07 -08:00
Mitchell Hashimoto 691db58478 terraform: apply for orphans 2015-02-19 12:08:05 -08:00
Mitchell Hashimoto aea6b0a7e1 terraform: compare bad diffs for apply 2015-02-19 12:08:05 -08:00
Mitchell Hashimoto 93f3050dbd terraform: make things more linear 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto ef32656a65 terraform: set the diff up properly with tainted resources 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto ec6ce69e90 terraform: destroy module plan 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto e185769271 terraform: plan destroy 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto 10a216d85e terraform: nil diffs should not be written to the diff 2015-02-19 12:08:02 -08:00
Mitchell Hashimoto e45308fa6d terraform: module orphans are properly expanded and planned for destroy 2015-02-19 12:08:01 -08:00
Mitchell Hashimoto aae2d4c780 terraform: starting up the plans 2015-02-19 12:08:00 -08:00