Commit Graph

9 Commits

Author SHA1 Message Date
James Nugent
6aac79e194 state: Add support for outputs of multiple types
This commit adds the groundwork for supporting module outputs of types
other than string. In order to do so, the state version is increased
from 1 to 2 (though the "public-facing" state version is actually as the
first state file was binary).

Tests are added to ensure that V2 (1) state is upgraded to V3 (2) state,
though no separate read path is required since the V2 JSON will
unmarshal correctly into the V3 structure.

Outputs in a ModuleState are now of type map[string]interface{}, and a
test covers round-tripping string, []string and map[string]string, which
should cover all of the types in question.

Type switches have been added where necessary to deal with the
interface{} value, but they currently default to panicking when the input
is not a string.
2016-05-10 14:40:12 -04:00
Paul Hinze
fbc9cf9ddb core: error instead of panic on self var in wrong scope
Fixes #4808
Fixes #5174
2016-02-23 11:44:24 -06:00
Mitchell Hashimoto
8be4afacf8 terraform: replace config/lang usage 2016-02-03 13:24:04 -05:00
Paul Hinze
48b172aa86 core: treat refs to unknown set resource attrs as unknown
References to computed list-ish attributes (set, list, map) were being
improperly resolved as an empty list `[]` during the plan phase (when
the value of the reference is not yet known) instead of as an
UnknownValue.

A "diffs didn't match" failure in an AWS DirectoryServices test led to
this discovery (and this commit fixes the failing test):

https://travis-ci.org/hashicorp/terraform/jobs/104812951

Refs #2157 which has the original work to support computed list
attributes at all. This is just a simple tweak to that work.

/cc @radeksimko
2016-01-26 13:50:44 -06:00
Anthony Stanton
3040d8419f Test removing weird zero+zero Route53 test case 2015-10-08 18:07:07 +02:00
Radek Simko
91d750d2df interpolate: Expand computed TypeList attributes properly 2015-08-27 13:02:02 +01:00
Mitchell Hashimoto
7735847579 terraform: splatting with computed values is computed [GH-2744] 2015-07-19 17:27:38 -07:00
Paul Hinze
347690a73e core: don't crash when count.index is used in the wrong context
It's bad manners! :)

Also adds a validation error up at the configuration layer so the user
sees the case from #1528 as an error message.

fixes #1528
2015-04-15 10:23:53 -05:00
Mitchell Hashimoto
76ce6e45f7 terraform: extract interpolation to its own struct
This is not really improving the way we do interpolation so much as its
just shuffling bits around. I don't want to refactor interpolation in
this branch so I needed to make the current way reusable so that I can
reuse it in the new Context.
2015-02-19 12:07:56 -08:00