From 50b8053476a97f31612b7d8b1cedcbe2c95a9766 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Wed, 12 Sep 2018 16:12:30 -0700 Subject: [PATCH] core: make providers available during the "plan destroy" walk We now use providers for schema-related actions during this walk, so we need to initialize them in a similar way as we do for other walks. --- terraform/graph_builder_destroy_plan.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/terraform/graph_builder_destroy_plan.go b/terraform/graph_builder_destroy_plan.go index 59c09669e..464e4d2fe 100644 --- a/terraform/graph_builder_destroy_plan.go +++ b/terraform/graph_builder_destroy_plan.go @@ -33,10 +33,6 @@ type DestroyPlanGraphBuilder struct { // Validate will do structural validation of the graph. Validate bool - - // ConcreteProvider, if set, gets an opportunity to specialize an - // abstract provider node. - ConcreteProvider ConcreteProviderNodeFunc } // See GraphBuilder @@ -56,6 +52,12 @@ func (b *DestroyPlanGraphBuilder) Steps() []GraphTransformer { } } + concreteProvider := func(a *NodeAbstractProvider) dag.Vertex { + return &NodeApplyableProvider{ + NodeAbstractProvider: a, + } + } + steps := []GraphTransformer{ // Creates nodes for the resource instances tracked in the state. &StateTransformer{ @@ -66,7 +68,7 @@ func (b *DestroyPlanGraphBuilder) Steps() []GraphTransformer { // Attach the configuration to any resources &AttachResourceConfigTransformer{Config: b.Config}, - TransformProviders(b.Components.ResourceProviders(), b.ConcreteProvider, b.Config), + TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config), // Destruction ordering. We require this only so that // targeting below will prune the correct things.