Commit Graph

7 Commits

Author SHA1 Message Date
James Bardin 057941ce18 make flatmap.Expand understand computed sets
For historical reasons, sets are represented as sparse lists in a
flatmap, however a computed set does not have a numeric index.

Strip the `~` flag from a computed set's index during expansion, and add
it back in the prefix after sorting.
2017-03-01 13:28:02 -05:00
Mitchell Hashimoto c6d0333dc0
flatmap: mark computed list as a computed value in Expand
Fixes #12183

The fix is in flatmap for this but the entire issue is a bit more
complex. Given a schema with a computed set, if you reference it like
this:

    lookup(attr[0], "field")

And "attr" contains a computed set within it, it would panic even though
"field" is available. There were a couple avenues I could've taken to
fix this:

1.) Any complex value containing any unknown value at any point is
entirely unknown.

2.) Only the specific part of the complex value is unknown.

I took route 2 so that the above works without any computed (since
"name" is not computed but something else is). This may actually have an
effect on other parts of Terraform configs, however those similar
configs would've simply crashed previously so it shouldn't break any
pre-existing configs.
2017-02-23 10:03:59 -08:00
James Bardin 1cec04b8a7 Add test for set expansion in flatmap.Expand 2017-01-04 16:11:46 -05:00
James Bardin c7f5d8b7e7 Add tests for nested structues in flatmap.Expand 2016-12-16 16:34:08 -05:00
Mitchell Hashimoto 308b88a8d8 flatmap: never auto-convert ints 2014-07-24 11:41:01 -07:00
Mitchell Hashimoto 1277c324d0 flatmap: deeper nesting tests 2014-07-08 13:57:55 -07:00
Mitchell Hashimoto ad2f448911 flatmap: expand 2014-07-01 13:25:54 -07:00