diff --git a/terraform/graph_builder_apply.go b/terraform/graph_builder_apply.go index cee423b91..a2e37aedf 100644 --- a/terraform/graph_builder_apply.go +++ b/terraform/graph_builder_apply.go @@ -115,16 +115,16 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer { // Add module variables &ModuleVariableTransformer{Config: b.Config}, + // Must be before TransformProviders and ReferenceTransformer, since + // schema is required to extract references from config. + &AttachSchemaTransformer{Components: b.Components}, + // add providers TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config), // Remove modules no longer present in the config &RemovedModuleTransformer{Config: b.Config, State: b.State}, - // Must be before ReferenceTransformer, since schema is required to - // extract references from config. - &AttachSchemaTransformer{Components: b.Components}, - // Connect references so ordering is correct &ReferenceTransformer{}, diff --git a/terraform/graph_builder_eval.go b/terraform/graph_builder_eval.go index de25ff237..df494f39f 100644 --- a/terraform/graph_builder_eval.go +++ b/terraform/graph_builder_eval.go @@ -70,6 +70,10 @@ func (b *EvalGraphBuilder) Steps() []GraphTransformer { // Add root variables &RootVariableTransformer{Config: b.Config}, + // Must be before TransformProviders and ReferenceTransformer, since + // schema is required to extract references from config. + &AttachSchemaTransformer{Components: b.Components}, + TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config), // Add the local values @@ -81,10 +85,6 @@ func (b *EvalGraphBuilder) Steps() []GraphTransformer { // Add module variables &ModuleVariableTransformer{Config: b.Config}, - // Must be before ReferenceTransformer, since schema is required to - // extract references from config. - &AttachSchemaTransformer{Components: b.Components}, - // Connect so that the references are ready for targeting. We'll // have to connect again later for providers and so on. &ReferenceTransformer{}, diff --git a/terraform/graph_builder_refresh.go b/terraform/graph_builder_refresh.go index b5d7d3208..f181a8e44 100644 --- a/terraform/graph_builder_refresh.go +++ b/terraform/graph_builder_refresh.go @@ -134,12 +134,12 @@ func (b *RefreshGraphBuilder) Steps() []GraphTransformer { // Add module variables &ModuleVariableTransformer{Config: b.Config}, - TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config), - - // Must be before ReferenceTransformer, since schema is required to - // extract references from config. + // Must be before TransformProviders and ReferenceTransformer, since + // schema is required to extract references from config. &AttachSchemaTransformer{Components: b.Components}, + TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config), + // Connect so that the references are ready for targeting. We'll // have to connect again later for providers and so on. &ReferenceTransformer{},