Commit Graph

259 Commits

Author SHA1 Message Date
Mitchell Hashimoto
e32cd396ad helper/schema: add test for GH-814 2015-01-16 08:37:25 -08:00
Sander van Harmelen
2edfd0e89d Just my OCD playing up 😉 2015-01-16 13:30:11 +01:00
Greg Osuri
2769d7cf9c Fixes #813: Ensuring set count (.#) is written to the state 2015-01-16 03:43:57 -08:00
Greg Osuri
f870eff5f9 core: fix for #813 - added a gaurd for interface conversion 2015-01-16 00:16:38 -08:00
Mitchell Hashimoto
448887f3c4 helper/schema: map counts in state 2015-01-15 14:12:24 -08:00
Mitchell Hashimoto
22436555a7 helper/schema: test setting computed value and retrieving it via state 2015-01-15 11:08:06 -08:00
Mitchell Hashimoto
4d067f4d6d helper/schema: don't put things into the state that don't exist or are
computed [GH-805]
2015-01-15 10:35:44 -08:00
Sander van Harmelen
133a40d77f Sets should init only once...
Currently the `sync.Once` call is only used to init a Set in the add()
func. So when you add a value to a Set that is the result of one of the
Set operations (i.e. union, difference, intersect) the Set will be
reinitialised and the exiting values will be lost.

I don’t have a clue why this is showing up in my ACC tests just now, as
this code is in there for quite some time already. Somehow it seems to
have something to do with the refactoring of the helper/schema done
last week, as I cannot reproduce this with
47f02f80bc
2015-01-15 15:33:52 +01:00
Mitchell Hashimoto
2abeb2d9ac config: use new API 2015-01-14 22:03:15 -08:00
Mitchell Hashimoto
db02541d31 helper/schema: fix failing tests
/cc @svanharmelen - I think some logic changed after my refactor. I now
return Exists: true when Computed: true but the value might be blank to
note that the FieldReader FOUND a value, its just unknown. I think
before it didn't do that so the logic for GetOk has to be "does it exist
and is it _not_ computed"

Seems weird because I just realized there is no way to get the OLD value
of something if it is being computed now, but I looked and there are
tests that verify this and they're like... test #5 of Get. So, they're
not new meaning that must've been expected behavior? Hm. Let me know if
you find any other issues from acceptance tests
2015-01-14 15:38:18 -08:00
Mitchell Hashimoto
05de36b4ea Merge pull request #796 from svanharmelen/f-test-issue-791
Adding a test for issue #791
2015-01-14 15:31:28 -08:00
Mitchell Hashimoto
d3c0543bf3 Merge pull request #797 from hashicorp/f-stronger-types
Force variables to be typed (internally)
2015-01-14 15:30:38 -08:00
Mitchell Hashimoto
e00ee1e5ee helper/diff: fix failing test 2015-01-14 15:29:56 -08:00
Mitchell Hashimoto
dbe83af829 helper/schema: fix failing tests 2015-01-14 15:28:36 -08:00
Sander van Harmelen
cb37e10c6f Adding a test for issue #791
Running this test on commit 47f02f80bc
from 6 days ago, is successful, but on master it now fails.
2015-01-14 20:50:58 +01:00
Mitchell Hashimoto
241fc5bb39 helper/schema: diff floats properly
/cc @phinze - This is pretty straightforward, almost magically so. The
reason this works is because in `diffString` we use mapstructure[1] with
"weak decode mode" to just be responisble for turning anything into a
string.

[1]: https://github.com/mitchellh/mapstructure
2015-01-14 09:32:03 -08:00
Mitchell Hashimoto
6fadebc5d8 Merge pull request #769 from phinze/type-float-failing-diff-test
failing schema diff test for TypeFloat
2015-01-14 09:30:08 -08:00
Mitchell Hashimoto
5e8b300ca1 update CHANGELOG 2015-01-14 09:29:37 -08:00
Emil Hessman
2bc612e6f8 helper/schema: fix panic when validating composite type
Don't check if the root key is being computed for composite types.
Instead, continue recursing the composite type in order to check if
the sub-key, key.N, for each individual element is being computed.

Fixes a panic which occurs when validating a composite type where
the value is an unknown kind for the schema.
2015-01-13 06:59:05 +01:00
Paul Hinze
bcac8c64bd failing schema diff test for TypeFloat
refs #768
2015-01-11 14:51:48 -06:00
Mitchell Hashimoto
1fcd24cf67 helper/schema: add float type 2015-01-10 16:04:01 -08:00
Mitchell Hashimoto
cf94a79955 helper/schema: add TypeFloat and Zero value 2015-01-10 15:57:06 -08:00
Mitchell Hashimoto
34617b337f helper/schema: remove commit not for this branch 2015-01-10 15:53:29 -08:00
Mitchell Hashimoto
689cbc8b5b helper/schema: generate strings for ValueType 2015-01-10 15:52:11 -08:00
Mitchell Hashimoto
3cbcafe989 helper/schema: remove unused field 2015-01-10 12:50:53 -08:00
Mitchell Hashimoto
361d00347a helper/schema: refactor tests for fieldreader to be common 2015-01-10 12:42:15 -08:00
Mitchell Hashimoto
9ab128899a helper/schema: make the getSource enum easier 2015-01-10 12:25:34 -08:00
Mitchell Hashimoto
d89446391a helper/schema: make the get API cleaner 2015-01-10 12:22:05 -08:00
Mitchell Hashimoto
3c1b55a75f helper/schema: use the field reader/writer for state 2015-01-10 12:18:32 -08:00
Mitchell Hashimoto
f64b09a045 helper/schema: more tests 2015-01-10 11:49:37 -08:00
Mitchell Hashimoto
e77b2b17c4 helper/schema: remove unused method 2015-01-10 11:46:09 -08:00
Mitchell Hashimoto
03c6453a72 helper/schema: FieldWriter, replace Set 2015-01-10 11:44:26 -08:00
Mitchell Hashimoto
e9a4aaaca7 helper/schema: full object test for addrToSchema 2015-01-09 17:43:44 -08:00
Mitchell Hashimoto
e57f3f69b1 helper/schema: empty maps, support reading objects directly 2015-01-09 15:07:02 -08:00
Mitchell Hashimoto
f0af1c36f5 helper/schema: nested resource fields should be zero-valued on get 2015-01-09 11:51:29 -08:00
Mitchell Hashimoto
942a988ac2 helper/schema: zero value of a set should be a set 2015-01-08 18:48:03 -08:00
Mitchell Hashimoto
b4bf813151 helper/schema: too big to fail 2015-01-08 18:02:19 -08:00
Mitchell Hashimoto
864a8f24ec helper/schema: GoString for Set 2015-01-08 11:33:15 -08:00
Mitchell Hashimoto
7e379cb1a1 helper/schema: field readers no longer take a schema as arg 2015-01-03 12:13:46 -05:00
Mitchell Hashimoto
3ff859d734 helper/schema: MultiLevelFieldReader 2015-01-03 10:32:24 -05:00
Mitchell Hashimoto
0b1da37b20 helper/schema: diff field reader should merge result with source 2015-01-03 09:55:38 -05:00
Mitchell Hashimoto
91a57b42e8 helper/schema: reading a diff with computed should return zero value 2015-01-03 12:02:49 +05:30
Mitchell Hashimoto
73726e83b2 helper/schema: DiffFieldReader for reading data from a diff 2014-12-20 02:17:35 +05:30
Mitchell Hashimoto
9447973015 helper/schema: ConfigFieldReader and generic helpers 2014-12-19 22:52:53 +05:30
Mitchell Hashimoto
5f063d321f helper/schema: FieldReader needs to return computed status 2014-12-19 06:15:04 -05:00
Mitchell Hashimoto
f416e0edf0 helper/schema: FieldReader and MapFieldReader 2014-12-19 05:56:46 -05:00
Mitchell Hashimoto
e8ac16b2df helper/schema: test for empty state 2014-12-16 15:56:40 -08:00
Mitchell Hashimoto
df05483cf6 helper/schema: test pass from SvH 2014-12-16 09:05:16 -08:00
Mitchell Hashimoto
913f9a923e helper/schema: remove unnecessary code 2014-12-15 17:39:07 -08:00
Mitchell Hashimoto
e5877543b2 helper/schema: track map element counts
This adds "field.#" values to the state/diff with the element count of a
map. This fixes a major issue around not knowing when child elements are
computed when doing variable access of a computed map.

Example, if you have a schema like this:

    "foo": &Schema{
        Type:     TypeMap,
        Computed: true,
    }

And you access it like this in a resource:

    ${type.name.foo.computed-field}

Then Terraform will error that "field foo could not be found on resource
type.name". By adding that "foo.#" is computed, Terraform core will pick
up that it WILL exist, so its okay.
2014-12-15 17:35:16 -08:00