Commit Graph

64 Commits

Author SHA1 Message Date
Mitchell Hashimoto
50afee2a30
terraform: Diff.Empty should be true for nil Diff 2016-10-19 13:38:01 -07:00
Mitchell Hashimoto
35d1868618
terraform: remove ModuleDiff.GoString
To address comments by @jbardin re: if we had a mutex this will fail
vet.
2016-10-19 10:07:47 -07:00
Mitchell Hashimoto
98fa7d92a4
terraform: support data source apply for shadows 2016-10-12 18:56:57 +08:00
Mitchell Hashimoto
31f8d13678
terraform: Diff.Equal and tests 2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
fdeb4656c9
terraform: deep copy shadow arguments to avoid state modifications
The arguments passed into Apply, Refresh, Diff could be modified which
caused the shadow comparison later to cause errors. Also, the result
should be deep copied so that it isn't modified.
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
5053872e82
terraform: Diff.DeepCopy test to catch a bug that in copystructure
This was fixed upstream but keeping the test around to prevent
regressions.
2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
f7134d95e4
terraform: Diff.DeepCopy 2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
e6d1e77a9a
Fix vet errors found with Go 1.7 2016-08-16 18:03:22 -07:00
Paul Hinze
3dccfa0cc9
terraform: diffs with only tainted set are non-empty
Fixes issue where a resource marked as tainted with no other attribute
diffs would never show up in the plan or apply as needing to be
replaced.

One unrelated test needed updating due to a quirk in the testDiffFn
logic - it adds a "type" field diff if the diff is non-Empty. NBD
2016-08-12 17:37:49 -05: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
James Bardin
0e507e7e5e Remove computed maps from the diff Same check
Just like computed sets, computed maps may have both different values
and different cardinality after they're computed. Remove the computed
maps and the values from the compared diffs.
2016-06-27 10:04:45 -04:00
James Nugent
1f9a2b241e Merge pull request #7207 from hashicorp/b-diff-maps
core/diff: Fix attribute mismatch with tags.%
2016-06-24 15:03:36 +03:00
clint shryock
9967641c4b core/diff: Fix attribute mismatch with tags.% 2016-06-16 18:22:21 -05:00
James Bardin
a5c1bf1b36 Don't check any parts of a computed hash in Same
When checking for "same" values in a computed hash, not only might some
of the values differ between versions changing the hash, but there may be
fields not included at all in the original map, and different overall
counts.

Instead of trying to match individual set fields with different hashes,
remove any hashed key longer than the computed key with the same base
name.
2016-06-16 18:42:48 -04:00
Chris Marchesi
9d7fb89114 core: Adding Sensitive attribute to resource schema
This an effort to address hashicorp/terraform#516.

Adding the Sensitive attribute to the resource schema, opening up the
ability for resource maintainers to mark some fields as sensitive.
Sensitive fields are hidden in the output, and, possibly in the future,
could be encrypted.
2016-05-29 22:18:44 -07: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
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
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
Anthony Scalisi
198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Sam Boyer
b82bd0c280 Condense switch fallthroughs into expr lists 2015-05-26 21:52:36 -04:00
Mitchell Hashimoto
19b33326be terraform: don't include variables in destroy node requirements 2015-05-06 20:13:19 -07:00
Paul Hinze
64f0897c82 core: avoid diff mismatch on NewRemoved fields during -/+
fixes #1508

In a DESTROY/CREATE scenario, the plan diff will be run against the
state of the old instance, while the apply diff will be run against an
empty state (because the state is cleared when the destroy node does its
thing.)

For complex attributes, this can result in keys that seem to disappear
between the two diffs, when in reality everything is working just fine.

Same() needs to take into account this scenario by analyzing NewRemoved
and treating as "Same" a diff that does indeed have that key removed.
2015-04-14 17:23:30 -05: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
10a216d85e terraform: nil diffs should not be written to the diff 2015-02-19 12:08:02 -08:00
Sander van Harmelen
d24ab685d0 Adding a small fix to the Same() func
This is a little tricky, but when a diff contains a computed list or
set that can only be interpolated after the apply command has created
the dependant resources, it could turn out that the result is actually
the same as the existing state which would remove the key from the diff
2014-12-16 13:58:31 +01:00
Sander van Harmelen
83c760fcb3 core: refactoring the way sets work internally v2
This is a refactored solution for PR #616. Functionally this is still
the same change, but it’s implemented a lot cleaner with less code and
less changes to existing parts of TF.
2014-12-12 23:21:20 +01:00
Armon Dadgar
d8ecb32a7c terraform: test module is marked for destroy 2014-11-24 15:50:15 -08:00
Armon Dadgar
d5fd4dabe8 terraform: Mark modules for destroy 2014-11-24 14:15:24 -08:00
Mitchell Hashimoto
ab6741f6fc terraform: require the prefix match with a "." in Diff.Instances 2014-10-10 13:46:44 -07:00
Mitchell Hashimoto
75e79da9c3 terraform: modify Same to return true if list is computed 2014-10-09 20:52:38 -07:00
Mitchell Hashimoto
4fe0c4ada4 terraform: don't use Meta node anymore 2014-10-01 18:06:25 -07:00
Mitchell Hashimoto
8c17062638 command: plan shows module-level, can control depth 2014-09-24 22:54:51 -07:00
Mitchell Hashimoto
a12f785211 terraform: add some helpers to ModuleDiff and InstanceDiff for UX 2014-09-24 17:51:45 -07:00
Mitchell Hashimoto
672bf58337 command: compiles, tests don't pass yet 2014-09-24 14:37:24 -07:00
Mitchell Hashimoto
b1a583e3de terraform: plan with modules work 2014-09-23 14:15:40 -07:00
Mitchell Hashimoto
bc67e7c443 terraform: diff is split down into modules 2014-09-23 11:43:21 -07:00
Mitchell Hashimoto
29603f36d2 terraform: remove Read/WriteDiff, we don't use it 2014-09-23 11:15:05 -07:00
Mitchell Hashimoto
06c862a379 terraform: tainted things all work 2014-09-19 22:47:53 -06:00
Mitchell Hashimoto
9b2b3a963f ResourceDiff => InstanceDiff 2014-09-17 16:33:24 -07:00
Mitchell Hashimoto
7564a0a21c terraform: set state properly when tainted 2014-07-26 21:03:07 -07:00
Mitchell Hashimoto
7221e01110 terraform: unit test Same function on ResourceDiff 2014-07-22 19:39:48 -07:00
Mitchell Hashimoto
d5e3d5a196 terraform: validate diffs are the same 2014-07-22 19:33:09 -07:00
Mitchell Hashimoto
96e09440d4 helper/diff: mark removed keys as removed 2014-07-09 09:51:36 -07:00
Mitchell Hashimoto
251790f05a terraform: add ID to diff implicitly 2014-07-08 16:58:31 -07:00
Mitchell Hashimoto
fb843ea5bf terraform: Added NewExtra field for providers to fill in data 2014-07-01 11:23:40 -07:00
Mitchell Hashimoto
ff79fa9c9f terraform: tests for ResourceDiff.Empty 2014-06-30 20:56:25 -07:00
Mitchell Hashimoto
4147500fcc terraform: diff is not empty if it has to destroy 2014-06-25 22:10:25 -07:00
Mitchell Hashimoto
1d9d33c8a0 terraform: destroy orphans 2014-06-25 21:58:33 -07:00
Mitchell Hashimoto
9c024994b7 terraform: diff has Destroy flag 2014-06-24 12:54:05 -07:00
Mitchell Hashimoto
175b720ab1 diff: mark diff properly with input/output 2014-06-23 12:49:30 -07:00