terraform/terraform
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
..
test-fixtures core: Allow lists and maps as variable overrides 2016-07-26 15:27:29 -05:00
context.go core: Allow lists and maps as variable overrides 2016-07-26 15:27:29 -05:00
context_apply_test.go core: Allow lists and maps as variable overrides 2016-07-26 15:27:29 -05:00
context_import.go terraform: Module option to Import to add module to graph 2016-05-11 13:02:37 -07:00
context_import_test.go terraform: Module option to Import to add module to graph 2016-05-11 13:02:37 -07:00
context_input_test.go core: Allow lists and maps as variable overrides 2016-07-26 15:27:29 -05:00
context_plan_test.go core: Convert context vars to map[string]interface{} 2016-07-18 13:02:54 -05:00
context_refresh_test.go core: Add missing OutputStates in synthetic state 2016-06-22 17:06:41 +03:00
context_test.go core: Fix empty multi-variable type 2016-06-12 14:00:16 +02:00
context_validate_test.go core: Convert context vars to map[string]interface{} 2016-07-18 13:02:54 -05:00
diff.go Remove computed maps from the diff Same check 2016-06-27 10:04:45 -04:00
diff_test.go Remove computed maps from the diff Same check 2016-06-27 10:04:45 -04:00
eval.go core: demote early exit log from ERROR -> DEBUG 2016-02-24 09:58:33 -06:00
eval_apply.go Add tests and fix last issues 2016-05-26 19:56:03 -05:00
eval_check_prevent_destroy.go update prevent_destroy error message 2015-08-13 09:57:52 -05:00
eval_context.go core: Use native HIL maps instead of flatmaps 2016-05-10 14:49:13 -04:00
eval_context_builtin.go Module variables not being interpolated 2016-05-23 13:44:09 -04:00
eval_context_builtin_test.go terraform: provider input should be scoped by path 2015-06-24 09:34:21 -07:00
eval_context_mock.go core: Use native HIL maps instead of flatmaps 2016-05-10 14:49:13 -04:00
eval_count.go
eval_diff.go terraform: another set of ignore_changes fixes 2016-07-08 16:48:23 -05:00
eval_diff_test.go
eval_error.go
eval_filter.go
eval_filter_operation.go
eval_if.go
eval_import_state.go terraform: import verifies the refresh results in non-nil state 2016-05-11 13:02:36 -07:00
eval_interpolate.go Module variables not being interpolated 2016-05-23 13:44:09 -04:00
eval_interpolate_test.go
eval_noop.go
eval_output.go core: Use OutputState in JSON instead of map 2016-05-18 13:25:20 -05:00
eval_provider.go core: close provider/provisioner connections 2015-06-19 21:52:50 +02:00
eval_provider_test.go core: close provider/provisioner connections 2015-06-19 21:52:50 +02:00
eval_provisioner.go core: close provider/provisioner connections 2015-06-19 21:52:50 +02:00
eval_provisioner_test.go core: close provider/provisioner connections 2015-06-19 21:52:50 +02:00
eval_read_data.go core: restore data resource creation diffs 2016-05-21 13:23:28 -07:00
eval_refresh.go providers/aws: security group import imports rules 2016-05-11 13:02:36 -07:00
eval_resource.go
eval_sequence.go
eval_sequence_test.go
eval_state.go Add tests and fix last issues 2016-05-26 19:56:03 -05:00
eval_state_test.go Add tests and fix last issues 2016-05-26 19:56:03 -05:00
eval_test.go
eval_validate.go core: rerun resource validation before plan and apply 2016-07-01 13:12:57 -05:00
eval_validate_test.go core: rerun resource validation before plan and apply 2016-07-01 13:12:57 -05:00
eval_variable.go core: Set all unknown keys to UnknownVariableValue 2016-07-08 16:44:40 +01:00
eval_variable_test.go terraform: allow literal maps to be passed to modules 2016-07-06 09:52:32 -05:00
evaltree_provider.go terraform: providers should input/config on import 2016-05-11 13:02:34 -07:00
graph.go core: fix deadlock when dependable node replaced with non-dependable one 2015-08-10 15:50:36 -05:00
graph_builder.go core: Print node types in traces 2016-04-13 10:20:18 -07:00
graph_builder_import.go terraform: Module option to Import to add module to graph 2016-05-11 13:02:37 -07:00
graph_builder_test.go Add tests and fix last issues 2016-05-26 19:56:03 -05:00
graph_config_node.go terraform: fill in more flat interfaces 2015-05-01 15:28:41 -07:00
graph_config_node_module.go core: Use native HIL maps instead of flatmaps 2016-05-10 14:49:13 -04:00
graph_config_node_module_test.go core: Remove module input transformer 2016-04-13 11:15:24 -05:00
graph_config_node_output.go Interpolation also skipped during Validate phase 2016-05-23 13:44:13 -04:00
graph_config_node_provider.go terraform: providers in flattened graphs should depend on the parent 2015-05-01 16:41:49 -07:00
graph_config_node_resource.go Add tests and fix last issues 2016-05-26 19:56:03 -05:00
graph_config_node_test.go terraform: redo how flattening works 2015-05-01 15:18:40 -07:00
graph_config_node_type.go
graph_config_node_variable.go Merge pull request #7493 from hashicorp/b-pass-map-to-module 2016-07-08 11:50:29 +01:00
graph_config_node_variable_test.go terraform: set variables in the proper location 2015-05-01 16:29:19 -07:00
graph_dot.go Fix three trivial errors 'go vet' discovered. 2015-05-13 21:23:07 -04:00
graph_dot_test.go removed extra parentheses 2015-10-08 15:48:04 +03:00
graph_interface_subgraph.go
graph_test.go core: fix deadlock when dependable node replaced with non-dependable one 2015-08-10 15:50:36 -05:00
graph_walk.go
graph_walk_context.go core: Use native HIL maps instead of flatmaps 2016-05-10 14:49:13 -04:00
graph_walk_operation.go terraform: start Import function, totally untested 2016-05-11 13:02:30 -07:00
graph_walk_test.go
graphnodeconfigtype_string.go Reflect new comment format in stringer.go 2015-11-09 11:38:51 -05:00
hook.go terraform: import state ID should be sent to hook 2016-05-11 13:02:35 -07:00
hook_mock.go terraform: import state ID should be sent to hook 2016-05-11 13:02:35 -07:00
hook_stop.go terraform: import state ID should be sent to hook 2016-05-11 13:02:35 -07:00
hook_stop_test.go
hook_test.go
instancetype.go
instancetype_string.go Reflect new comment format in stringer.go 2015-11-09 11:38:51 -05:00
interpolate.go core: Fix interpolation tests with nested lists 2016-07-11 17:02:12 -06:00
interpolate_test.go core: Fix interpolation tests with nested lists 2016-07-11 17:02:12 -06:00
path.go
plan.go core: Convert context vars to map[string]interface{} 2016-07-18 13:02:54 -05:00
plan_test.go core: Convert context vars to map[string]interface{} 2016-07-18 13:02:54 -05:00
resource.go core: Allow "." character in map keys 2016-07-14 12:38:43 -06:00
resource_address.go core: ResourceAddress supports data resources 2016-05-14 08:26:36 -07:00
resource_address_test.go core: ResourceAddress supports data resources 2016-05-14 08:26:36 -07:00
resource_provider.go core: New ResourceProvider methods for data resources 2016-05-14 08:26:36 -07:00
resource_provider_mock.go core: New ResourceProvider methods for data resources 2016-05-14 08:26:36 -07:00
resource_provider_mock_test.go terraform: provider mock should close itself to find bugs 2015-06-29 10:33:37 -07:00
resource_provider_test.go
resource_provisioner.go core: close provider/provisioner connections 2015-06-19 21:52:50 +02:00
resource_provisioner_mock.go
resource_provisioner_mock_test.go
resource_test.go Add tests for maps with dots 2016-07-20 14:08:14 -04:00
semantics.go core: Allow lists and maps as variable overrides 2016-07-26 15:27:29 -05:00
semantics_test.go core: Convert context vars to map[string]interface{} 2016-07-18 13:02:54 -05:00
state.go Merge pull request #7370 from tpounds/show-tf-ver-on-state-mismatch 2016-06-29 10:48:13 -05:00
state_add.go Update newly added code to work with the updated taint semantics 2016-05-26 19:56:03 -05:00
state_add_test.go Update newly added code to work with the updated taint semantics 2016-05-26 19:56:03 -05:00
state_filter.go Add tests and fix last issues 2016-05-26 19:56:03 -05:00
state_filter_test.go terraform: state filter wasn't comparing resource names 2016-05-10 14:49:14 -04:00
state_test.go Fix state version error message check. 2016-06-27 13:42:44 -07:00
state_upgrade_v1_to_v2.go Don't nil module maps during state upgrade 2016-06-29 09:17:25 -04:00
state_upgrade_v2_to_v3.go core: Introduce state v3 and upgrade process 2016-06-09 10:49:49 +01:00
state_v1.go core: Introduce state v3 and upgrade process 2016-06-09 10:49:49 +01:00
terraform_test.go core: Allow lists and maps as variable overrides 2016-07-26 15:27:29 -05:00
transform.go
transform_config.go Type check variables between modules (#6185) 2016-04-15 12:07:54 -07:00
transform_config_test.go
transform_deposed.go Add operation walkDestroy 2015-10-03 14:16:40 -07:00
transform_destroy.go Change taint behaviour to act as a normal resource 2016-05-26 19:55:26 -05:00
transform_destroy_test.go Add tests and fix last issues 2016-05-26 19:56:03 -05:00
transform_expand.go terraform: orphan module should flatten 2015-05-14 20:54:33 -07:00
transform_expand_test.go
transform_flatten.go remove various typos 2015-09-11 11:56:20 -07:00
transform_flatten_test.go terraform: add module destroy node to graph 2015-05-01 18:26:35 -07:00
transform_import_state.go terraform: import verifies the refresh results in non-nil state 2016-05-11 13:02:36 -07:00
transform_module.go core: Remove module input transformer 2016-04-13 11:15:24 -05:00
transform_module_test.go core: Remove module input transformer 2016-04-13 11:15:24 -05:00
transform_noop.go terraform: remove print 2015-07-20 08:57:35 -07:00
transform_noop_test.go terraform: PruneNoopTransformer 2015-07-20 08:57:34 -07:00
transform_orphan.go Change taint behaviour to act as a normal resource 2016-05-26 19:55:26 -05:00
transform_orphan_test.go core: Orphan addressing / targeting 2016-01-19 17:48:44 -06:00
transform_output.go Add operation walkDestroy 2015-10-03 14:16:40 -07:00
transform_output_test.go core: Use OutputState in JSON instead of map 2016-05-18 13:25:20 -05:00
transform_provider.go terraform: getting providers to connect the way we want for modules 2016-05-11 13:02:32 -07:00
transform_provider_test.go terraform: more provider transform tests 2016-05-11 13:02:32 -07:00
transform_provisioner.go Cleaning up the PruneProvisionerTransformer 2016-02-04 21:32:10 +01:00
transform_provisioner_test.go Cleaning up the PruneProvisionerTransformer 2016-02-04 21:32:10 +01:00
transform_proxy.go
transform_proxy_test.go
transform_resource.go terraform: another set of ignore_changes fixes 2016-07-08 16:48:23 -05:00
transform_resource_test.go
transform_root.go terraform: prune resources and variables 2015-07-20 08:57:34 -07:00
transform_root_test.go
transform_targets.go core: Orphan addressing / targeting 2016-01-19 17:48:44 -06:00
transform_targets_test.go
transform_transitive_reduction.go
transform_transitive_reduction_test.go
transform_vertex.go
transform_vertex_test.go
ui_input.go
ui_input_mock.go
ui_input_prefix.go
ui_input_prefix_test.go
ui_output.go
ui_output_callback.go
ui_output_callback_test.go
ui_output_mock.go
ui_output_mock_test.go
ui_output_provisioner.go
ui_output_provisioner_test.go
upgrade_state_v1_test.go Don't nil module maps during state upgrade 2016-06-29 09:17:25 -04:00
upgrade_state_v2_test.go core: Add test for V2->V3 state upgrade 2016-06-09 11:16:34 +01:00
util.go
util_test.go
version.go Add VersionString 2016-07-21 16:43:49 -04:00
walkoperation_string.go terraform: generate 2016-05-11 13:02:30 -07:00