core: Run AttachSchemaTransformer twice to catch provider nodes too
Both ProviderTransformer and ReferenceTransformer need schema information, and so there's a chicken-and-egg problem here where previously the schemas were not getting attached to provider nodes created during ProviderTransformer. As a stop-gap measure for now we'll just run AttachSchemaTransformer twice, so we can catch any new nodes created during the provider transforms.
This commit is contained in:
parent
88b5607a7a
commit
f7aa06726a
|
@ -119,13 +119,18 @@ 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.
|
||||
// Must be run before TransformProviders so that resource configurations
|
||||
// can be analyzed.
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
// add providers
|
||||
TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config),
|
||||
|
||||
// Attach schema to the newly-created provider nodes.
|
||||
// (Will also redundantly re-attach schema to existing resource nodes,
|
||||
// but that's okay.)
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
// Remove modules no longer present in the config
|
||||
&RemovedModuleTransformer{Config: b.Config, State: b.State},
|
||||
|
||||
|
|
|
@ -73,12 +73,6 @@ 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{Schemas: b.Schemas},
|
||||
|
||||
TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config),
|
||||
|
||||
// Add the local values
|
||||
&LocalTransformer{Config: b.Config},
|
||||
|
||||
|
@ -88,6 +82,17 @@ func (b *EvalGraphBuilder) Steps() []GraphTransformer {
|
|||
// Add module variables
|
||||
&ModuleVariableTransformer{Config: b.Config},
|
||||
|
||||
// Must be run before TransformProviders so that resource configurations
|
||||
// can be analyzed.
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config),
|
||||
|
||||
// Attach schema to the newly-created provider nodes.
|
||||
// (Will also redundantly re-attach schema to existing resource nodes,
|
||||
// but that's okay.)
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
// Connect so that the references are ready for targeting. We'll
|
||||
// have to connect again later for providers and so on.
|
||||
&ReferenceTransformer{},
|
||||
|
|
|
@ -61,12 +61,17 @@ func (b *ImportGraphBuilder) Steps() []GraphTransformer {
|
|||
// Add root variables
|
||||
&RootVariableTransformer{Config: b.Config},
|
||||
|
||||
// Must be before TransformProviders and ReferenceTransformer, since
|
||||
// schema is required to extract references from config.
|
||||
// Must be run before TransformProviders so that resource configurations
|
||||
// can be analyzed.
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
TransformProviders(b.Components.ResourceProviders(), concreteProvider, config),
|
||||
|
||||
// Attach schema to the newly-created provider nodes.
|
||||
// (Will also redundantly re-attach schema to existing resource nodes,
|
||||
// but that's okay.)
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
// This validates that the providers only depend on variables
|
||||
&ImportProviderValidateTransformer{},
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer {
|
|||
|
||||
&MissingProvisionerTransformer{Provisioners: b.Components.ResourceProvisioners()},
|
||||
|
||||
// Must be run before TransformProviders so that resource configurations
|
||||
// can be analyzed.
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
// Add module variables
|
||||
|
@ -116,13 +118,14 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer {
|
|||
|
||||
TransformProviders(b.Components.ResourceProviders(), b.ConcreteProvider, b.Config),
|
||||
|
||||
// Attach schema to the newly-created provider nodes.
|
||||
// (Will also redundantly re-attach schema to existing resource nodes,
|
||||
// but that's okay.)
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
// 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{Schemas: b.Schemas},
|
||||
|
||||
// Connect so that the references are ready for targeting. We'll
|
||||
// have to connect again later for providers and so on.
|
||||
&ReferenceTransformer{},
|
||||
|
|
|
@ -138,12 +138,17 @@ func (b *RefreshGraphBuilder) Steps() []GraphTransformer {
|
|||
// Add module variables
|
||||
&ModuleVariableTransformer{Config: b.Config},
|
||||
|
||||
// Must be before TransformProviders and ReferenceTransformer, since
|
||||
// schema is required to extract references from config.
|
||||
// Must be run before TransformProviders so that resource configurations
|
||||
// can be analyzed.
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
TransformProviders(b.Components.ResourceProviders(), concreteProvider, b.Config),
|
||||
|
||||
// Attach schema to the newly-created provider nodes.
|
||||
// (Will also redundantly re-attach schema to existing resource nodes,
|
||||
// but that's okay.)
|
||||
&AttachSchemaTransformer{Schemas: b.Schemas},
|
||||
|
||||
// Connect so that the references are ready for targeting. We'll
|
||||
// have to connect again later for providers and so on.
|
||||
&ReferenceTransformer{},
|
||||
|
|
|
@ -139,12 +139,17 @@ func (t *DestroyEdgeTransformer) Transform(g *Graph) error {
|
|||
&RootVariableTransformer{Config: t.Config},
|
||||
&ModuleVariableTransformer{Config: t.Config},
|
||||
|
||||
// Must be before ReferenceTransformer, since schema is required to
|
||||
// extract references from config.
|
||||
// Must be run before TransformProviders so that resource configurations
|
||||
// can be analyzed.
|
||||
&AttachSchemaTransformer{Schemas: t.Schemas},
|
||||
|
||||
TransformProviders(nil, providerFn, t.Config),
|
||||
|
||||
// Attach schema to the newly-created provider nodes.
|
||||
// (Will also redundantly re-attach schema to existing resource nodes,
|
||||
// but that's okay.)
|
||||
&AttachSchemaTransformer{Schemas: t.Schemas},
|
||||
|
||||
&ReferenceTransformer{},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue