terraform/terraform
Martin Atkins 45b04c826a core: don't crash if no module state exists for multi var
For child modules, a ModuleState isn't allocated until the first time a
module instance is inserted into the state under the module's path.
Normally interpolations of resource attributes are delayed until at least
one resource has been created due to the nature of the dependency graph,
but if the interpolation value is a multi-var (splat) then it is possible
that the referenced resource has count=0 and thus created _no_ resource
states when it was visited.

Previously we would crash when trying to access the resource map for the
nil module in order to count how many instances are present. Since we know
there can't be any instances present in a nil module, we now preempt
this crash by returning zero early.

This edge-case does not apply to the root module because its ModuleState
is allocated as part of initializing the main State instance.

This fixes #14438.
2017-05-16 09:54:33 -07:00
..
test-fixtures core: don't crash if no module state exists for multi var 2017-05-16 09:54:33 -07:00
context.go context Refresh and Apply sometimes return nil 2017-04-14 14:56:10 -04:00
context_apply_test.go core: don't crash if no module state exists for multi var 2017-05-16 09:54:33 -07:00
context_components.go terraform: switch to a component factory 2016-10-11 22:17:29 +08:00
context_graph_type.go terraform: wip moving validation to new graph 2017-01-25 12:28:07 -08:00
context_import.go terraform: switch to Context for stop, Stoppable provisioners 2017-01-26 15:03:27 -08:00
context_import_test.go terraform: import graph should setup parent refs to providers 2017-01-24 15:36:45 -08:00
context_input_test.go Add failing test for invalid interpolation 2017-03-16 10:35:18 -04:00
context_plan_test.go core: context test for partially-unknown splat lists 2017-05-04 16:55:32 -07:00
context_refresh_test.go terraform: unknown value for variables not set 2017-03-17 15:33:33 -07:00
context_test.go Add a failing test for missing keys in diff 2017-03-20 17:44:37 -04:00
context_validate_test.go Merge pull request #10934 from hashicorp/f-provisioner-stop 2017-01-30 12:53:15 -08:00
debug.go terraform: fix compilation by complying with interface 2017-01-20 20:45:06 -08:00
debug_test.go website: add destroy provisioners to getting started 2017-01-21 08:31:18 -08:00
diff.go Correctly filter flatmapped values in diff 2017-03-21 09:11:54 -04:00
diff_test.go terraform: ignore RequiresNew for collection removal in diff.Same 2017-02-06 17:46:48 -08:00
edge_destroy.go terraform: starting CBD, destroy edge for the destroy relationship 2016-10-19 13:38:52 -07:00
eval.go core: demote early exit log from ERROR -> DEBUG 2016-02-24 09:58:33 -06:00
eval_apply.go terraform: introduce EvalApplyPre so that PreApply is called even for 2017-01-20 20:36:53 -08:00
eval_check_prevent_destroy.go terraform: prevent_destroy works for decreasing count 2016-10-28 21:31:47 -04:00
eval_context.go terraform: switch to Context for stop, Stoppable provisioners 2017-01-26 15:03:27 -08:00
eval_context_builtin.go terraform: switch to Context for stop, Stoppable provisioners 2017-01-26 15:03:27 -08: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 terraform: switch to Context for stop, Stoppable provisioners 2017-01-26 15:03:27 -08:00
eval_count.go terraform: catch scenario where both "foo" and "foo.0" are in state 2015-03-01 21:28:41 -08:00
eval_count_boundary.go terraform: new graph fixes ".0" and "" boundaries on counts 2016-10-19 13:38:52 -07:00
eval_count_computed.go terraform: detect compute counts and show a nicer error 2016-11-11 11:07:17 -08:00
eval_diff.go Correctly filter flatmapped values in diff 2017-03-21 09:11:54 -04:00
eval_diff_test.go terraform: destroy node should not create 2015-02-24 22:45:47 -08:00
eval_error.go core: [refactor] store Deposed resource instances as a list 2015-03-04 12:25:59 -06:00
eval_filter.go
eval_filter_operation.go
eval_if.go core: [refactor] pull Deposed out of Tainted list 2015-03-04 12:25:47 -06:00
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 Check for multi-values maps in output too 2016-10-07 15:09:03 -04:00
eval_output_test.go Check for multi-values maps in output too 2016-10-07 15:09:03 -04:00
eval_provider.go core: Input walk shouldn't clobber dynamic provider config 2017-04-04 10:31:42 -07:00
eval_provider_test.go core: Input walk shouldn't clobber dynamic provider config 2017-04-04 10:31:42 -07: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: don't force data resource id diff to be empty 2016-09-24 12:48:58 -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 terraform: don't validate computed values in validate 2017-01-27 21:15:43 -08:00
eval_sequence_test.go
eval_state.go terraform: write lock on post state updates 2016-11-21 15:21:35 -08: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 Detect and reject unknown attributes in "connection" blocks 2017-04-06 13:46:43 -07:00
eval_validate_selfref.go terraform: validate self references 2017-01-25 21:00:45 -08:00
eval_validate_selfref_test.go terraform: validate self references 2017-01-25 21:00:45 -08:00
eval_validate_test.go Detect and reject unknown attributes in "connection" blocks 2017-04-06 13:46:43 -07:00
eval_variable.go core: EvalVariableBlock to decode maps and slices more carefully 2017-04-07 17:05:14 -07:00
eval_variable_test.go core: basic test of EvalVariableBlock 2017-04-04 12:16:19 -07:00
evaltree_provider.go terraform: providers should input/config on import 2016-05-11 13:02:34 -07:00
graph.go terraform: remove ConnectDependents and related interfaces 2017-02-03 14:25:54 +01:00
graph_builder.go terraform: remove legacy graph builder 2017-01-26 15:18:42 -08:00
graph_builder_apply.go core: Restore CountBoundaryTransformer to apply, add/adjust tests 2017-04-19 22:23:52 -07:00
graph_builder_apply_test.go Add the close provider and provisioner transformers (#13102) 2017-04-12 23:25:15 +02:00
graph_builder_destroy_plan.go terraform: new Graph API that can return the graph for each op 2016-12-02 22:56:22 -05:00
graph_builder_import.go Add the close provider and provisioner transformers (#13102) 2017-04-12 23:25:15 +02:00
graph_builder_input.go terraform: wip moving validation to new graph 2017-01-25 12:28:07 -08:00
graph_builder_plan.go core: Restore CountBoundaryTransformer to apply, add/adjust tests 2017-04-19 22:23:52 -07:00
graph_builder_plan_test.go core: Restore CountBoundaryTransformer to apply, add/adjust tests 2017-04-19 22:23:52 -07:00
graph_builder_refresh.go core: New refresh graph building behaviour 2017-05-12 15:45:06 -07:00
graph_builder_refresh_test.go core: Test for new refresh graph behaviour 2017-05-12 15:45:06 -07:00
graph_builder_test.go terraform: remove legacy graph builder 2017-01-26 15:18:42 -08:00
graph_builder_validate.go terraform: expand count on resources during validation 2017-01-25 12:39:08 -08:00
graph_dot.go Remove dot package 2016-11-14 08:50:34 -05:00
graph_dot_test.go terraform: remove ConnectDependents and related interfaces 2017-02-03 14:25:54 +01:00
graph_interface_subgraph.go terraform: subpath context setting 2015-05-01 14:19:32 -07:00
graph_test.go terraform: remove ConnectDependents and related interfaces 2017-02-03 14:25:54 +01:00
graph_walk.go Replace DebugGraphs with the Graph's methods 2016-11-14 08:52:18 -05:00
graph_walk_context.go terraform: string through the context meta 2017-03-13 16:21:09 -07:00
graph_walk_operation.go terraform: start Import function, totally untested 2016-05-11 13:02:30 -07:00
graph_walk_test.go
graphtype_string.go Restore stringer-generated files back to new version 2017-04-21 14:49:18 -07:00
hook.go terraform: PostProvision hook gets the error from the provision step 2017-01-20 20:21:12 -08:00
hook_mock.go terraform: PostProvision hook gets the error from the provision step 2017-01-20 20:21:12 -08:00
hook_stop.go terraform: PostProvision hook gets the error from the provision step 2017-01-20 20:21:12 -08:00
hook_stop_test.go
hook_test.go
instancetype.go core: formalize resource addressing 2015-03-31 15:04:10 -05:00
instancetype_string.go Restore stringer-generated files back to new version 2017-04-21 14:49:18 -07:00
interpolate.go core: don't crash if no module state exists for multi var 2017-05-16 09:54:33 -07:00
interpolate_test.go core: don't crash if no module state exists for multi var 2017-05-16 09:54:33 -07:00
node_count_boundary.go terraform: new graph fixes ".0" and "" boundaries on counts 2016-10-19 13:38:52 -07:00
node_data_destroy.go terraform: data source on refresh should just delete from state 2017-02-03 20:58:03 +01:00
node_data_refresh.go core: Fix destroy factory in data source refresh expander 2017-05-12 15:45:06 -07:00
node_data_refresh_test.go core: Test for new refresh graph behaviour 2017-05-12 15:45:06 -07:00
node_module_destroy.go terraform: destroy module nodes show up in plan destroy 2016-10-22 12:12:29 -07:00
node_module_variable.go terraform: TargetsTransformer should preserve module variables 2016-12-12 20:59:14 -08:00
node_module_variable_test.go terraform: tests for module variable node 2016-10-19 13:38:51 -07:00
node_output.go core: Allow downstream targeting of certain node types 2017-05-11 11:57:46 -07:00
node_output_orphan.go terraform: prune orphan outputs in old graph 2016-11-08 13:24:09 -08:00
node_provider.go terraform: refactor NodeApplyableProvider to use NodeAbstractProvider 2016-12-03 15:27:38 -08:00
node_provider_abstract.go terraform: don't include providers if not targeted 2017-02-17 09:21:29 -08:00
node_provider_disabled.go terraform: disable providers in new apply graph 2016-10-19 14:54:00 -07:00
node_provisioner.go terraform: new provisioner node 2017-01-26 21:02:55 -08:00
node_resource_abstract.go remove duplicates in Dependencies 2017-04-08 15:37:15 -04:00
node_resource_abstract_count.go terraform: don't validate computed values in validate 2017-01-27 21:15:43 -08:00
node_resource_apply.go terraform: convert StateDeps to use new structs 2017-01-26 20:47:20 -08:00
node_resource_destroy.go terraform: destroy resource should depend on destroy-time prov deps 2017-02-17 13:13:44 -08:00
node_resource_destroy_test.go terraform: Destroy node should only include deposed for specific index 2016-11-29 09:16:18 -08:00
node_resource_plan.go terraform: handle count fields for data sources 2017-01-22 16:05:10 -08:00
node_resource_plan_destroy.go terraform: Destroy node should only include deposed for specific index 2016-11-29 09:16:18 -08:00
node_resource_plan_instance.go terraform: convert StateDeps to use new structs 2017-01-26 20:47:20 -08:00
node_resource_plan_orphan.go terraform: Destroy node should only include deposed for specific index 2016-11-29 09:16:18 -08:00
node_resource_refresh.go core: New refresh graph building behaviour 2017-05-12 15:45:06 -07:00
node_resource_refresh_test.go core: Test for new refresh graph behaviour 2017-05-12 15:45:06 -07:00
node_resource_validate.go Detect and reject unknown attributes in "connection" blocks 2017-04-06 13:46:43 -07:00
node_root_variable.go terraform: RootVariableTransform 2016-10-19 13:38:51 -07:00
path.go
plan.go terraform: support backends in the state 2017-01-26 14:33:49 -08:00
plan_test.go terraform: add Meta field to diffs 2017-01-31 11:50:37 -08:00
resource.go ResourceConfig.get should never return (nil, true) 2016-11-18 16:24:40 -05:00
resource_address.go terraform: test case for #10982 (passes) 2017-02-13 13:06:22 -08:00
resource_address_test.go terraform: test case for #10982 (passes) 2017-02-13 13:06:22 -08:00
resource_provider.go terraform: Stop API added to ResourceProvider 2016-10-25 12:09:44 -07:00
resource_provider_mock.go move TestReset mock from terraform to helper 2017-03-08 17:48:11 -05:00
resource_provider_mock_test.go terraform: provider mock should close itself to find bugs 2015-06-29 10:33:37 -07:00
resource_provisioner.go terraform: switch to Context for stop, Stoppable provisioners 2017-01-26 15:03:27 -08:00
resource_provisioner_mock.go terraform: switch to Context for stop, Stoppable provisioners 2017-01-26 15:03:27 -08:00
resource_provisioner_mock_test.go
resource_test.go Nested lists and maps fail in GetRaw 2016-11-28 09:04:12 -05:00
semantics.go terraform: remove GraphNodeModule 2017-01-26 20:01:39 -08:00
semantics_test.go terraform: user friendly error when using old map overrides 2016-12-09 15:58:24 -05:00
shadow.go terraform: Shadow interface, properly string through errors at the right 2016-10-11 22:17:29 +08:00
shadow_components.go terraform: if components is closed, initialize closed components 2016-10-19 14:10:46 -07:00
shadow_context.go terraform: string through the context meta 2017-03-13 16:21:09 -07:00
shadow_resource_provider.go terraform: EvalInstanceInfo on data sources in new graph 2016-11-15 09:02:10 -08:00
shadow_resource_provider_test.go terraform: ShadowError returns errors, not the close operation 2016-10-11 22:17:30 +08:00
shadow_resource_provisioner.go terraform: switch to Context for stop, Stoppable provisioners 2017-01-26 15:03:27 -08:00
shadow_resource_provisioner_test.go terraform: ResourceProvisioner shadow 2016-10-11 22:17:30 +08:00
state.go core: fix a crash by suggesting a different approach to solve #11170 (#13541) 2017-04-14 22:32:30 +02:00
state_add.go Set proper Mode when moving a data source in state 2016-11-21 18:26:29 -05:00
state_add_test.go Set proper Mode when moving a data source in state 2016-11-21 18:26:29 -05:00
state_filter.go fix sorting of module resources during state mv 2017-02-23 18:27:16 -05:00
state_filter_test.go terraform: StateFilter handles cases where ResourceState has no type 2017-01-21 10:24:03 -08:00
state_test.go core: fix a crash by suggesting a different approach to solve #11170 (#13541) 2017-04-14 22:32:30 +02:00
state_upgrade_v1_to_v2.go terraform: convert empty path to root path in V1 state 2017-03-21 11:37:12 -07:00
state_upgrade_v1_to_v2_test.go terraform: convert empty path to root path in V1 state 2017-03-21 11:37:12 -07:00
state_upgrade_v2_to_v3.go terraform: V1 to V2 upgrade should treat nil path as root path 2017-03-21 11:12:44 -07:00
state_v1.go core: Introduce state v3 and upgrade process 2016-06-09 10:49:49 +01:00
terraform_test.go Fix test that relied on empty Old diff 2017-03-20 17:44:38 -04:00
testing.go terraform: support backends in the state 2017-01-26 14:33:49 -08:00
transform.go terraform: unify destroy/apply graph builders 2016-10-22 12:12:30 -07:00
transform_attach_config_provider.go terraform: configure provider aliases in the new apply graph 2016-11-04 16:51:52 -07:00
transform_attach_config_resource.go terraform: enable shadow graph and destroy resource mode with addr 2016-10-22 12:12:30 -07:00
transform_attach_state.go terraform: passing test for destroy edge for module only 2017-02-07 19:12:03 -08:00
transform_config.go terraform: ConfigTransformer has Unique and mode filters 2017-01-22 12:58:18 -08:00
transform_config_flat.go terraform: CBD makes the proper edge connections for dependent resources 2016-10-19 13:38:53 -07:00
transform_config_flat_test.go terraform: FlatConfigTransformer 2016-10-19 13:38:53 -07:00
transform_config_old.go terraform: remove config transformer old 2017-01-26 19:57:46 -08:00
transform_config_test.go terraform: ConfigTransformer has Unique and mode filters 2017-01-22 12:58:18 -08:00
transform_count_boundary.go terraform: new graph fixes ".0" and "" boundaries on counts 2016-10-19 13:38:52 -07:00
transform_deposed.go terraform: introduce EvalApplyPre so that PreApply is called even for 2017-01-20 20:36:53 -08:00
transform_destroy_cbd.go terraform: CBD edge should ignore "index" 2017-02-07 10:53:12 -08:00
transform_destroy_cbd_test.go terraform: CBD edge should ignore "index" 2017-02-07 10:53:12 -08:00
transform_destroy_edge.go terraform: destroy ordering needs to handle destroy provisioner edges 2017-02-17 14:29:22 -08:00
transform_destroy_edge_test.go terraform: passing test for destroy edge for module only 2017-02-07 19:12:03 -08:00
transform_diff.go terraform: new apply graph understands destroying deposed only 2016-11-28 14:34:24 -08:00
transform_diff_test.go terraform: remove diff transformer test that no longer happens 2016-10-19 13:38:52 -07:00
transform_expand.go terraform: more dead code removal 2017-01-26 19:47:02 -08:00
transform_expand_test.go implement dag.Subgrapher interface 2016-11-14 08:50:34 -05:00
transform_import_provider.go terraform: verify import providers only depend on vars 2016-11-09 15:09:13 -08:00
transform_import_state.go Implements import with specified provider 2016-11-23 11:58:58 +01:00
transform_module_variable.go terraform: add module vars after providers to see references 2016-12-13 21:22:21 -08:00
transform_module_variable_test.go terraform: module variables should be pruned if nothing depends on them 2016-11-04 18:58:03 -07:00
transform_orphan_count.go terraform: fix a typo found during review 2016-11-09 08:10:09 -08:00
transform_orphan_count_test.go terraform: proper "what to orphan" on zero/one boundary logic 2016-11-08 13:59:29 -08:00
transform_orphan_output.go terraform: orphan outputs are deleted from the state 2016-10-19 13:38:52 -07:00
transform_orphan_resource.go terraform: don't prune state on init() 2016-12-02 11:48:34 -05:00
transform_orphan_resource_test.go terraform: don't prune state on init() 2016-12-02 11:48:34 -05:00
transform_output.go terraform: get tests to not panic on failures 2016-10-19 13:38:51 -07:00
transform_provider.go terraform: close transform should not include untargeted providers 2017-02-17 09:27:47 -08:00
transform_provider_disable.go terraform: disable providers in new apply graph 2016-10-19 14:54:00 -07:00
transform_provider_test.go terraform: close transform should not include untargeted providers 2017-02-17 09:27:47 -08:00
transform_provisioner.go terraform: remove flatten, forever 2017-01-26 21:03:27 -08:00
transform_provisioner_test.go terraform: new provisioner node 2017-01-26 21:02:55 -08:00
transform_reference.go terraform: remove node module file 2017-01-26 20:05:42 -08:00
transform_reference_test.go terraform: tests for ReferenceMap for module paths 2016-11-12 08:24:09 -08:00
transform_resource_count.go terraform: expand count in plan 2016-11-08 13:59:26 -08:00
transform_resource_refresh_plannable.go core: New refresh graph building behaviour 2017-05-12 15:45:06 -07:00
transform_root.go terraform: provider transform is converted to new graph world view 2017-01-26 20:58:22 -08:00
transform_root_test.go terraform: convert root transform test to use new config transform 2017-01-26 19:40:46 -08:00
transform_state.go terraform: implement destroy planning basics from state 2016-10-22 12:12:29 -07:00
transform_targets.go core: Allow downstream targeting of certain node types 2017-05-11 11:57:46 -07:00
transform_targets_test.go core: Allow downstream targeting of certain node types 2017-05-11 11:57:46 -07:00
transform_transitive_reduction.go terraform: add TransitiveReductionTransformer 2015-02-27 19:18:04 -08:00
transform_transitive_reduction_test.go terraform: convert all tests to use the new config transformer 2017-01-26 19:56:16 -08:00
transform_variable.go terraform: RootVariableTransform 2016-10-19 13:38:51 -07:00
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 Ensure better state normalization 2016-08-12 11:09:50 -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 remove duplicates in Dependencies 2017-04-08 15:37:15 -04:00
util_test.go don't forget to test the simple things 2017-04-08 15:37:15 -04:00
variables.go Return an error for setting a non-map to a map 2016-11-17 11:10:43 -05:00
variables_test.go Add failing test for GH-10155 2016-11-16 18:20:59 -05:00
version.go release: clean up after v0.9.5 2017-05-11 09:32:32 +00:00
version_required.go terraform: verify version requirements from configuration 2016-11-12 16:50:26 -08:00
walkoperation_string.go Restore stringer-generated files back to new version 2017-04-21 14:49:18 -07:00