Commit Graph

34 Commits

Author SHA1 Message Date
Mitchell Hashimoto 5390357e45 helper/schema: sets properly take into account the diff 2014-10-20 15:32:30 -07:00
Mitchell Hashimoto 59349cca11 helper/schema: sets must be treated atomically within ResourceData
This fixes a seemingly minor issue (GH-255) around plans showing changes
when in fact there are none. But in reality this turned out to uncover a
really terrible bug.

The effect of what was happening was that multiple items in a set were
being merged. Now, they were being merged in the right order, so if you
didn't have rich types (lists in a set) then you never saw the effect
since the later value would overwrite the earlier. But with lists (such
as in security groups), you would end up with the lists merging. So, if
you had one ingress rule with CIDR blocks and one with SGs, then after
the merge both ingress rules would have BOTH CIDR and SGs, resulting in
an incorrect plan (GH-255).

This fixes the issue by introducing a `getSourceExact` bitflag to the
ResourceData source. When this is set, ALL data must come from this
level, instead of merging lower levels. In the case of sets and diffs,
this is exactly what you want: "Get me the set 'foo' from the config and
the config ONLY (not the state or diff or w/e)".

Andddddd its fixed.

GH-255
2014-10-11 10:40:54 -07:00
Mitchell Hashimoto 3a107d2e50 helper/schema: set the field to empty if it is a list and computed 2014-10-10 15:58:38 -07:00
Mitchell Hashimoto 9b2b3a963f ResourceDiff => InstanceDiff 2014-09-17 16:33:24 -07:00
Mitchell Hashimoto 81d9d70296 helper/schema: conforms to new API, tests pass 2014-09-16 17:07:13 -07:00
Mitchell Hashimoto faa4e75960 helper/schema: Get on computed diff should be empty 2014-08-27 15:45:52 -07:00
Mitchell Hashimoto 87a488092c helper/schema: support partial states 2014-08-26 20:19:44 -07:00
Mitchell Hashimoto 9ed601d541 helper/schema: store state with processed properly 2014-08-22 12:09:06 -07:00
Mitchell Hashimoto 50026a6d5c helper/schema: When having a StateFunc, make sure NewExtra contains
original
2014-08-22 08:57:44 -07:00
Mitchell Hashimoto d009ea800a helper/schema: add support for StateFunc 2014-08-22 08:45:54 -07:00
Mitchell Hashimoto 7be2f1b091 helper/schema: add GetOk 2014-08-21 23:03:04 -07:00
Mitchell Hashimoto 37cf52fa27 helper/schema: if no ID is set then return nil 2014-08-21 22:19:33 -07:00
Mitchell Hashimoto 3d3789920d helper/schema: can set conninfo 2014-08-21 22:15:47 -07:00
Mitchell Hashimoto ca18e971d1 helper/schema: can set sets 2014-08-20 21:09:06 -07:00
Mitchell Hashimoto 9fe21f0423 helper/schema: verify that sets remove duplicates 2014-08-20 21:09:06 -07:00
Mitchell Hashimoto 56dde5c0c1 helper/schema: can read and get the state of sets 2014-08-20 21:09:06 -07:00
Mitchell Hashimoto 5fc41cc272 helper/schema: properly put "id" into attributes 2014-08-20 10:38:51 -07:00
Mitchell Hashimoto ee0acc4a5d helper/schema: support bools 2014-08-19 16:46:36 -07:00
Mitchell Hashimoto ba819d1f37 helper/schema: don't include zero count in state 2014-08-18 19:12:49 -07:00
Mitchell Hashimoto 1b85f3a565 helper/schema: SetDependencies 2014-08-18 15:41:12 -07:00
Mitchell Hashimoto dfede5791c helper/schema: use reflection to set maps 2014-08-18 15:17:18 -07:00
Mitchell Hashimoto 3800dffdeb helper/schema: computed values should not be Get-able 2014-08-18 15:10:53 -07:00
Mitchell Hashimoto 4ae1673580 helper/schema: support for NewRemoved 2014-08-18 15:07:09 -07:00
Mitchell Hashimoto 4c9271160e helper/schema: can handle maps 2014-08-18 14:00:03 -07:00
Mitchell Hashimoto 66d7003e6f helper/schema: HasChange 2014-08-18 10:00:41 -07:00
Mitchell Hashimoto f1f4836c99 helper/schema: GetChange 2014-08-18 09:58:44 -07:00
Mitchell Hashimoto 539e4da03f helper/schema: more tests 2014-08-17 20:48:50 -07:00
Mitchell Hashimoto c3f1f49640 helper/schema: final state for lists/objects works 2014-08-17 14:12:54 -07:00
Mitchell Hashimoto 06d30a559a helper/schema: Set object 2014-08-17 11:38:16 -07:00
Mitchell Hashimoto 2d74a3cadd helper/schema: basic set 2014-08-16 15:02:51 -07:00
Mitchell Hashimoto bf6ad07505 helper/schema: ResourceData.Get can get the full object 2014-08-16 13:55:10 -07:00
Mitchell Hashimoto 43e4921bd9 helper/schema: more tests, todo tests for computedwhen 2014-08-16 13:32:21 -07:00
Mitchell Hashimoto 1d9528e595 helper/schema: ResourceData.Get works in most cases 2014-08-15 17:39:08 -07:00
Mitchell Hashimoto 31067ee8f6 helper/schema: ResourceData, starting tests 2014-08-15 16:32:43 -07:00