Commit Graph

15 Commits

Author SHA1 Message Date
Mitchell Hashimoto
31c813fa51
terraform: remove GraphNodeModule 2017-01-26 20:01:39 -08:00
Mitchell Hashimoto
808f09f01f
terraform: user friendly error when using old map overrides
Related to #8036

We have had this behavior for a _long_ time now (since 0.7.0) but it
seems people are still periodically getting bit by it. This adds an
explicit error message that explains that this kind of override isn't
allowed anymore.
2016-12-09 15:58:24 -05:00
James Bardin
3297a460c7 Allow map variables from json
A JSON object will be decoded as a list with a single map value. This
will be properly coerced later, so let it through the initial config
semantic checks.
2016-09-27 13:29:14 -04:00
James Nugent
681d94ae20 core: Allow lists and maps as variable overrides
Terraform 0.7 introduces lists and maps as first-class values for
variables, in addition to string values which were previously available.
However, there was previously no way to override the default value of a
list or map, and the functionality for overriding specific map keys was
broken.

Using the environment variable method for setting variable values, there
was previously no way to give a variable a value of a list or map. These
now support HCL for individual values - specifying:

    TF_VAR_test='["Hello", "World"]'

will set the variable `test` to a two-element list containing "Hello"
and "World". Specifying

    TF_VAR_test_map='{"Hello = "World", "Foo" = "bar"}'

will set the variable `test_map` to a two-element map with keys "Hello"
and "Foo", and values "World" and "bar" respectively.

The same logic is applied to `-var` flags, and the file parsed by
`-var-files` ("autoVariables").

Note that care must be taken to not run into shell expansion for `-var-`
flags and environment variables.

We also merge map keys where appropriate. The override syntax has
changed (to be noted in CHANGELOG as a breaking change), so several
tests needed their syntax updating from the old `amis.us-east-1 =
"newValue"` style to `amis = "{ "us-east-1" = "newValue"}"` style as
defined in TF-002.

In order to continue supporting the `-var "foo=bar"` type of variable
flag (which is not valid HCL), a special case error is checked after HCL
parsing fails, and the old code path runs instead.
2016-07-26 15:27:29 -05:00
James Nugent
5d18f41f04 core: Convert context vars to map[string]interface{}
This is the first step in allowing overrides of map and list variables.
We convert Context.variables to map[string]interface{} from
map[string]string and fix up all the call sites.
2016-07-18 13:02:54 -05:00
Mitchell Hashimoto
21e4501edb terraform: start implementing interfaces for semantic checks 2015-02-19 12:07:52 -08:00
Mitchell Hashimoto
b9f49b2f60 terraform: semantic check that variables are set on the correct types 2014-07-22 09:27:28 -07:00
Mitchell Hashimoto
a19e2983de terraform: tests passing for Config change 2014-07-18 22:13:15 -07:00
Mitchell Hashimoto
c8c7d6baa3 terraform: add some semantic check functions 2014-07-02 20:47:10 -07:00
Mitchell Hashimoto
4b263992cc terraform: remove unused code 2014-06-25 18:13:58 -07:00
Mitchell Hashimoto
cdab89d7c1 terraform: getting closer to mapping resource providers properly 2014-06-25 12:58:27 -07:00
Mitchell Hashimoto
1918f199d8 terraform: Graph, config: don't build graph 2014-06-24 14:58:57 -07:00
Mitchell Hashimoto
d58feeeafe terraform: find configs for providers 2014-06-05 19:56:35 -07:00
Mitchell Hashimoto
4397c566a0 terraform: computed key 2014-06-05 12:09:25 -07:00
Mitchell Hashimoto
02fde14fb6 terraform: simplify semantic checks out into sep functions 2014-06-05 11:53:07 -07:00