terraform: PlanGraphBuilder

This commit is contained in:
Mitchell Hashimoto 2016-11-05 16:26:12 -07:00
parent ce4ff06d25
commit 4f0d68dda4
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
16 changed files with 294 additions and 77 deletions

View File

@ -129,7 +129,7 @@ func (b *BuiltinGraphBuilder) Build(path []string) (*Graph, error) {
func (b *BuiltinGraphBuilder) Steps(path []string) []GraphTransformer { func (b *BuiltinGraphBuilder) Steps(path []string) []GraphTransformer {
steps := []GraphTransformer{ steps := []GraphTransformer{
// Create all our resources from the configuration and state // Create all our resources from the configuration and state
&ConfigTransformer{Module: b.Root}, &ConfigTransformerOld{Module: b.Root},
&OrphanTransformer{ &OrphanTransformer{
State: b.State, State: b.State,
Module: b.Root, Module: b.Root,

View File

@ -38,7 +38,7 @@ func (b *ImportGraphBuilder) Steps() []GraphTransformer {
steps := []GraphTransformer{ steps := []GraphTransformer{
// Create all our resources from the configuration and state // Create all our resources from the configuration and state
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
// Add the import steps // Add the import steps
&ImportStateTransformer{Targets: b.ImportTargets}, &ImportStateTransformer{Targets: b.ImportTargets},

View File

@ -0,0 +1,101 @@
package terraform
import (
"github.com/hashicorp/terraform/config/module"
"github.com/hashicorp/terraform/dag"
)
// PlanGraphBuilder implements GraphBuilder and is responsible for building
// a graph for planning (creating a Terraform Diff).
//
// The primary difference between this graph and others:
//
// * Based on the config since it represents the target state
//
// * Ignores lifecycle options since no lifecycle events occur here. This
// simplifies the graph significantly since complex transforms such as
// create-before-destroy can be completely ignored.
//
type PlanGraphBuilder struct {
// Module is the root module for the graph to build.
Module *module.Tree
// State is the current state
State *State
// Providers is the list of providers supported.
Providers []string
// DisableReduce, if true, will not reduce the graph. Great for testing.
DisableReduce bool
}
// See GraphBuilder
func (b *PlanGraphBuilder) Build(path []string) (*Graph, error) {
return (&BasicGraphBuilder{
Steps: b.Steps(),
Validate: true,
Name: "plan",
}).Build(path)
}
// See GraphBuilder
func (b *PlanGraphBuilder) Steps() []GraphTransformer {
// Custom factory for creating providers.
providerFactory := func(name string, path []string) GraphNodeProvider {
return &NodeApplyableProvider{
NameValue: name,
PathValue: path,
}
}
concreteResource := func(a *NodeAbstractResource) dag.Vertex {
return &NodeApplyableResource{
NodeAbstractResource: a,
}
}
steps := []GraphTransformer{
// Creates all the resources represented in the config
&ConfigTransformer{
Concrete: concreteResource,
Module: b.Module,
},
// Add the outputs
&OutputTransformer{Module: b.Module},
// Attach the configuration to any resources
&AttachResourceConfigTransformer{Module: b.Module},
// Attach the state
&AttachStateTransformer{State: b.State},
// Create all the providers
&MissingProviderTransformer{Providers: b.Providers, Factory: providerFactory},
&ProviderTransformer{},
&DisableProviderTransformer{},
&ParentProviderTransformer{},
&AttachProviderConfigTransformer{Module: b.Module},
// Add root variables
&RootVariableTransformer{Module: b.Module},
// Add module variables
&ModuleVariableTransformer{Module: b.Module},
// Connect references so ordering is correct
&ReferenceTransformer{},
// Single root
&RootTransformer{},
}
if !b.DisableReduce {
// Perform the transitive reduction to make our graph a bit
// more sane if possible (it usually is possible).
steps = append(steps, &TransitiveReductionTransformer{})
}
return steps
}

View File

@ -26,7 +26,7 @@ func TestGraphNodeConfigModuleExpand(t *testing.T) {
g, err := node.Expand(&BasicGraphBuilder{ g, err := node.Expand(&BasicGraphBuilder{
Steps: []GraphTransformer{ Steps: []GraphTransformer{
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
}, },
}) })
if err != nil { if err != nil {
@ -51,7 +51,7 @@ func TestGraphNodeConfigModuleExpandFlatten(t *testing.T) {
g, err := node.Expand(&BasicGraphBuilder{ g, err := node.Expand(&BasicGraphBuilder{
Steps: []GraphTransformer{ Steps: []GraphTransformer{
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
}, },
}) })
if err != nil { if err != nil {

View File

@ -9,21 +9,30 @@ import (
"github.com/hashicorp/terraform/config/module" "github.com/hashicorp/terraform/config/module"
) )
// ConfigTransformer is a GraphTransformer that adds the configuration // ConfigTransformer is a GraphTransformer that adds all the resources
// to the graph. The module used to configure this transformer must be // from the configuration to the graph.
// the root module. We'll look up the child module by the Path in the //
// Graph. // The module used to configure this transformer must be the root module.
//
// Only resources are added to the graph. Variables, outputs, and
// providers must be added via other transforms.
//
// Unlike ConfigTransformerOld, this transformer creates a graph with
// all resources including module resources, rather than creating module
// nodes that are then "flattened".
type ConfigTransformer struct { type ConfigTransformer struct {
Module *module.Tree Module *module.Tree
} }
func (t *ConfigTransformer) Transform(g *Graph) error { func (t *ConfigTransformer) Transform(g *Graph) error {
// A module is required and also must be completely loaded. // If no module is given, we don't do anything
if t.Module == nil { if t.Module == nil {
return errors.New("module must not be nil") return nil
} }
// If the module isn't loaded, that is simply an error
if !t.Module.Loaded() { if !t.Module.Loaded() {
return errors.New("module must be loaded") return errors.New("module must be loaded for ConfigTransformer")
} }
// Get the module we care about // Get the module we care about
@ -105,19 +114,3 @@ func (t *ConfigTransformer) Transform(g *Graph) error {
return err return err
} }
// varNameForVar returns the VarName value for an interpolated variable.
// This value is compared to the VarName() value for the nodes within the
// graph to build the graph edges.
func varNameForVar(raw config.InterpolatedVariable) string {
switch v := raw.(type) {
case *config.ModuleVariable:
return fmt.Sprintf("module.%s.output.%s", v.Name, v.Field)
case *config.ResourceVariable:
return v.ResourceId()
case *config.UserVariable:
return fmt.Sprintf("var.%s", v.Name)
default:
return ""
}
}

View File

@ -0,0 +1,123 @@
package terraform
import (
"errors"
"fmt"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform/config"
"github.com/hashicorp/terraform/config/module"
)
// ConfigTransformerOld is a GraphTransformer that adds the configuration
// to the graph. The module used to configure this transformer must be
// the root module. We'll look up the child module by the Path in the
// Graph.
type ConfigTransformerOld struct {
Module *module.Tree
}
func (t *ConfigTransformerOld) Transform(g *Graph) error {
// A module is required and also must be completely loaded.
if t.Module == nil {
return errors.New("module must not be nil")
}
if !t.Module.Loaded() {
return errors.New("module must be loaded")
}
// Get the module we care about
module := t.Module.Child(g.Path[1:])
if module == nil {
return nil
}
// Get the configuration for this module
config := module.Config()
// Create the node list we'll use for the graph
nodes := make([]graphNodeConfig, 0,
(len(config.Variables)+
len(config.ProviderConfigs)+
len(config.Modules)+
len(config.Resources)+
len(config.Outputs))*2)
// Write all the variables out
for _, v := range config.Variables {
nodes = append(nodes, &GraphNodeConfigVariable{
Variable: v,
ModuleTree: t.Module,
ModulePath: g.Path,
})
}
// Write all the provider configs out
for _, pc := range config.ProviderConfigs {
nodes = append(nodes, &GraphNodeConfigProvider{Provider: pc})
}
// Write all the resources out
for _, r := range config.Resources {
nodes = append(nodes, &GraphNodeConfigResource{
Resource: r,
Path: g.Path,
})
}
// Write all the modules out
children := module.Children()
for _, m := range config.Modules {
path := make([]string, len(g.Path), len(g.Path)+1)
copy(path, g.Path)
path = append(path, m.Name)
nodes = append(nodes, &GraphNodeConfigModule{
Path: path,
Module: m,
Tree: children[m.Name],
})
}
// Write all the outputs out
for _, o := range config.Outputs {
nodes = append(nodes, &GraphNodeConfigOutput{Output: o})
}
// Err is where the final error value will go if there is one
var err error
// Build the graph vertices
for _, n := range nodes {
g.Add(n)
}
// Build up the dependencies. We have to do this outside of the above
// loop since the nodes need to be in place for us to build the deps.
for _, n := range nodes {
if missing := g.ConnectDependent(n); len(missing) > 0 {
for _, m := range missing {
err = multierror.Append(err, fmt.Errorf(
"%s: missing dependency: %s", n.Name(), m))
}
}
}
return err
}
// varNameForVar returns the VarName value for an interpolated variable.
// This value is compared to the VarName() value for the nodes within the
// graph to build the graph edges.
func varNameForVar(raw config.InterpolatedVariable) string {
switch v := raw.(type) {
case *config.ModuleVariable:
return fmt.Sprintf("module.%s.output.%s", v.Name, v.Field)
case *config.ResourceVariable:
return v.ResourceId()
case *config.UserVariable:
return fmt.Sprintf("var.%s", v.Name)
default:
return ""
}
}

View File

@ -8,15 +8,15 @@ import (
"github.com/hashicorp/terraform/config/module" "github.com/hashicorp/terraform/config/module"
) )
func TestConfigTransformer_nilModule(t *testing.T) { func TestConfigTransformerOld_nilModule(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{} tf := &ConfigTransformerOld{}
if err := tf.Transform(&g); err == nil { if err := tf.Transform(&g); err == nil {
t.Fatal("should error") t.Fatal("should error")
} }
} }
func TestConfigTransformer_unloadedModule(t *testing.T) { func TestConfigTransformerOld_unloadedModule(t *testing.T) {
mod, err := module.NewTreeModule( mod, err := module.NewTreeModule(
"", filepath.Join(fixtureDir, "graph-basic")) "", filepath.Join(fixtureDir, "graph-basic"))
if err != nil { if err != nil {
@ -24,15 +24,15 @@ func TestConfigTransformer_unloadedModule(t *testing.T) {
} }
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err == nil { if err := tf.Transform(&g); err == nil {
t.Fatal("should error") t.Fatal("should error")
} }
} }
func TestConfigTransformer(t *testing.T) { func TestConfigTransformerOld(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{Module: testModule(t, "graph-basic")} tf := &ConfigTransformerOld{Module: testModule(t, "graph-basic")}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -44,9 +44,9 @@ func TestConfigTransformer(t *testing.T) {
} }
} }
func TestConfigTransformer_dependsOn(t *testing.T) { func TestConfigTransformerOld_dependsOn(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{Module: testModule(t, "graph-depends-on")} tf := &ConfigTransformerOld{Module: testModule(t, "graph-depends-on")}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -58,9 +58,9 @@ func TestConfigTransformer_dependsOn(t *testing.T) {
} }
} }
func TestConfigTransformer_modules(t *testing.T) { func TestConfigTransformerOld_modules(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{Module: testModule(t, "graph-modules")} tf := &ConfigTransformerOld{Module: testModule(t, "graph-modules")}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -72,9 +72,9 @@ func TestConfigTransformer_modules(t *testing.T) {
} }
} }
func TestConfigTransformer_outputs(t *testing.T) { func TestConfigTransformerOld_outputs(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{Module: testModule(t, "graph-outputs")} tf := &ConfigTransformerOld{Module: testModule(t, "graph-outputs")}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -86,9 +86,9 @@ func TestConfigTransformer_outputs(t *testing.T) {
} }
} }
func TestConfigTransformer_providerAlias(t *testing.T) { func TestConfigTransformerOld_providerAlias(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{Module: testModule(t, "graph-provider-alias")} tf := &ConfigTransformerOld{Module: testModule(t, "graph-provider-alias")}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -100,9 +100,9 @@ func TestConfigTransformer_providerAlias(t *testing.T) {
} }
} }
func TestConfigTransformer_errMissingDeps(t *testing.T) { func TestConfigTransformerOld_errMissingDeps(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
tf := &ConfigTransformer{Module: testModule(t, "graph-missing-deps")} tf := &ConfigTransformerOld{Module: testModule(t, "graph-missing-deps")}
if err := tf.Transform(&g); err == nil { if err := tf.Transform(&g); err == nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }

View File

@ -10,7 +10,7 @@ func TestDestroyTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -35,7 +35,7 @@ func TestDestroyTransformer_dependsOn(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -60,7 +60,7 @@ func TestCreateBeforeDestroyTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -92,7 +92,7 @@ func TestCreateBeforeDestroyTransformer_twice(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -125,7 +125,7 @@ func TestPruneDestroyTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -168,7 +168,7 @@ func TestPruneDestroyTransformer_diff(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -202,7 +202,7 @@ func TestPruneDestroyTransformer_count(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -251,7 +251,7 @@ func TestPruneDestroyTransformer_countDec(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -297,7 +297,7 @@ func TestPruneDestroyTransformer_countState(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -347,7 +347,7 @@ func TestPruneDestroyTransformer_prefixMatch(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -396,7 +396,7 @@ func TestPruneDestroyTransformer_tainted(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }

View File

@ -11,7 +11,7 @@ func TestFlattenTransformer(t *testing.T) {
var b BasicGraphBuilder var b BasicGraphBuilder
b = BasicGraphBuilder{ b = BasicGraphBuilder{
Steps: []GraphTransformer{ Steps: []GraphTransformer{
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
&VertexTransformer{ &VertexTransformer{
Transforms: []GraphVertexTransformer{ Transforms: []GraphVertexTransformer{
&ExpandTransform{ &ExpandTransform{
@ -41,7 +41,7 @@ func TestFlattenTransformer_withProxy(t *testing.T) {
var b BasicGraphBuilder var b BasicGraphBuilder
b = BasicGraphBuilder{ b = BasicGraphBuilder{
Steps: []GraphTransformer{ Steps: []GraphTransformer{
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
&VertexTransformer{ &VertexTransformer{
Transforms: []GraphVertexTransformer{ Transforms: []GraphVertexTransformer{
&ExpandTransform{ &ExpandTransform{

View File

@ -35,7 +35,7 @@ func TestOrphanTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -86,7 +86,7 @@ func TestOrphanTransformer_modules(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -140,7 +140,7 @@ func TestOrphanTransformer_modulesDeps(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -194,7 +194,7 @@ func TestOrphanTransformer_modulesDepsOrphan(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -233,7 +233,7 @@ func TestOrphanTransformer_modulesNoRoot(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -282,7 +282,7 @@ func TestOrphanTransformer_resourceDepends(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -305,7 +305,7 @@ func TestOrphanTransformer_nilState(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }

View File

@ -27,7 +27,7 @@ func TestAddOutputOrphanTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }

View File

@ -12,7 +12,7 @@ func TestProviderTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -73,7 +73,7 @@ func TestCloseProviderTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -105,7 +105,7 @@ func TestCloseProviderTransformer_withTargets(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
transforms := []GraphTransformer{ transforms := []GraphTransformer{
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
&ProviderTransformer{}, &ProviderTransformer{},
&CloseProviderTransformer{}, &CloseProviderTransformer{},
&TargetsTransformer{ &TargetsTransformer{
@ -135,7 +135,7 @@ func TestMissingProviderTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -318,7 +318,7 @@ func TestPruneProviderTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -364,7 +364,7 @@ func TestDisableProviderTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
transforms := []GraphTransformer{ transforms := []GraphTransformer{
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
&MissingProviderTransformer{Providers: []string{"aws"}}, &MissingProviderTransformer{Providers: []string{"aws"}},
&ProviderTransformer{}, &ProviderTransformer{},
&DisableProviderTransformerOld{}, &DisableProviderTransformerOld{},
@ -390,7 +390,7 @@ func TestDisableProviderTransformer_keep(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
transforms := []GraphTransformer{ transforms := []GraphTransformer{
&ConfigTransformer{Module: mod}, &ConfigTransformerOld{Module: mod},
&MissingProviderTransformer{Providers: []string{"aws"}}, &MissingProviderTransformer{Providers: []string{"aws"}},
&ProviderTransformer{}, &ProviderTransformer{},
&DisableProviderTransformerOld{}, &DisableProviderTransformerOld{},

View File

@ -12,7 +12,7 @@ func TestMissingProvisionerTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -112,7 +112,7 @@ func TestCloseProvisionerTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }

View File

@ -10,7 +10,7 @@ func TestRootTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }

View File

@ -10,7 +10,7 @@ func TestTargetsTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -41,7 +41,7 @@ func TestTargetsTransformer_destroy(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }

View File

@ -10,7 +10,7 @@ func TestTransitiveReductionTransformer(t *testing.T) {
g := Graph{Path: RootModulePath} g := Graph{Path: RootModulePath}
{ {
tf := &ConfigTransformer{Module: mod} tf := &ConfigTransformerOld{Module: mod}
if err := tf.Transform(&g); err != nil { if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }