From 1b3f5beeec57162cfdeef4f38c670651d89a0b56 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 24 Mar 2020 12:11:27 -0400 Subject: [PATCH] udpate core to work with new ExpandResource This also calls ExpandModuleResource in one location, because the logic is not yet updated to handle actual module expansion, but that will be fixed in a forthcoming PR. --- terraform/node_data_refresh.go | 2 +- terraform/node_resource_plan.go | 3 +-- terraform/node_resource_refresh.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/terraform/node_data_refresh.go b/terraform/node_data_refresh.go index 02d230155b..f6c3f6d928 100644 --- a/terraform/node_data_refresh.go +++ b/terraform/node_data_refresh.go @@ -68,7 +68,7 @@ func (n *NodeRefreshableDataResource) DynamicExpand(ctx EvalContext) (*Graph, er default: expander.SetResourceSingle(path, n.ResourceAddr().Resource) } - instanceAddrs = append(instanceAddrs, expander.ExpandResource(path.Module(), n.ResourceAddr().Resource)...) + instanceAddrs = append(instanceAddrs, expander.ExpandResource(n.ResourceAddr().Absolute(path))...) } // Our graph transformers require access to the full state, so we'll diff --git a/terraform/node_resource_plan.go b/terraform/node_resource_plan.go index 0a339e6bbc..73e059a644 100644 --- a/terraform/node_resource_plan.go +++ b/terraform/node_resource_plan.go @@ -70,9 +70,8 @@ func (n *NodePlannableResource) DynamicExpand(ctx EvalContext) (*Graph, error) { // Our instance expander should already have been informed about the // expansion of this resource and of all of its containing modules, so // it can tell us which instance addresses we need to process. - module := ctx.Path().Module() expander := ctx.InstanceExpander() - instanceAddrs := expander.ExpandResource(module, n.ResourceAddr().Resource) + instanceAddrs := expander.ExpandResource(n.ResourceAddr().Absolute(ctx.Path())) // We need to potentially rename an instance address in the state // if we're transitioning whether "count" is set at all. diff --git a/terraform/node_resource_refresh.go b/terraform/node_resource_refresh.go index 2284d1e431..68a087708b 100644 --- a/terraform/node_resource_refresh.go +++ b/terraform/node_resource_refresh.go @@ -75,7 +75,7 @@ func (n *NodeRefreshableManagedResource) DynamicExpand(ctx EvalContext) (*Graph, expander.SetResourceSingle(module, n.ResourceAddr().Resource) } } - instanceAddrs := expander.ExpandResource(n.Addr.Module, n.ResourceAddr().Resource) + instanceAddrs := expander.ExpandModuleResource(n.Addr.Module, n.ResourceAddr().Resource) // Our graph transformers require access to the full state, so we'll // temporarily lock it while we work on this.