core: Attach schemas before dealing with provider edges

Since ProviderTransformer now needs the schema in order to infer indirect
references to providers, we must run AttachSchemaTransformer before the
provider transformers in order to calculate the correct ordering of
operations.
This commit is contained in:
Martin Atkins 2018-05-25 19:28:18 -07:00
parent a2728759cd
commit b144497041
3 changed files with 12 additions and 12 deletions

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},