diff --git a/go.sh b/go.sh index 44e2c0198..ca473ad65 100755 --- a/go.sh +++ b/go.sh @@ -1 +1 @@ -go test ./terraform -Xnew-destroy | grep -E '(FAIL|panic)' | tee /dev/tty | wc -l +go test ./terraform -Xnew-apply -Xnew-destroy | grep -E '(FAIL|panic)' | tee /dev/tty | wc -l diff --git a/terraform/context.go b/terraform/context.go index 8d49d3859..eddceccae 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -438,11 +438,6 @@ func (c *Context) Apply() (*State, error) { log.Printf("[WARN] terraform: real graph is experiment, shadow is experiment") real = shadow } else { - // TODO: remove before branch is done, we're just not ready for this yet - if c.destroy { - shadow = nil - } - log.Printf("[WARN] terraform: real graph is original, shadow is experiment") } @@ -452,6 +447,11 @@ func (c *Context) Apply() (*State, error) { shadow = real } + // TODO: remove before branch is done, we're just not ready for this yet + if c.destroy { + shadow = nil + } + // Determine the operation operation := walkApply if c.destroy { diff --git a/terraform/diff.go b/terraform/diff.go index 86be4bb5a..89dc947fe 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -238,10 +238,6 @@ func (d *ModuleDiff) IsRoot() bool { func (d *ModuleDiff) String() string { var buf bytes.Buffer - if d.Destroy { - buf.WriteString("DESTROY MODULE\n") - } - names := make([]string, 0, len(d.Resources)) for name, _ := range d.Resources { names = append(names, name) diff --git a/terraform/graph_builder_destroy_plan.go b/terraform/graph_builder_destroy_plan.go index 2b1444fd9..e0cd231f3 100644 --- a/terraform/graph_builder_destroy_plan.go +++ b/terraform/graph_builder_destroy_plan.go @@ -50,9 +50,6 @@ func (b *DestroyPlanGraphBuilder) Steps() []GraphTransformer { // Attach the configuration to any resources &AttachResourceConfigTransformer{Module: b.Module}, - // Module destroy nodes - &ModuleDestroyTransformer{State: b.State}, - // Single root &RootTransformer{}, } diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index e6f4bdec9..8c4724757 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -1139,7 +1139,6 @@ DIFF: DESTROY: aws_instance.foo module.child: - DESTROY MODULE DESTROY: aws_instance.foo STATE: @@ -1156,10 +1155,8 @@ const testTerraformPlanModuleDestroyCycleStr = ` DIFF: module.a_module: - DESTROY MODULE DESTROY: aws_instance.a module.b_module: - DESTROY MODULE DESTROY: aws_instance.b STATE: @@ -1176,7 +1173,6 @@ const testTerraformPlanModuleDestroyMultivarStr = ` DIFF: module.child: - DESTROY MODULE DESTROY: aws_instance.foo.0 DESTROY: aws_instance.foo.1 diff --git a/terraform/transform_module_destroy.go b/terraform/transform_module_destroy.go deleted file mode 100644 index bf6e450f1..000000000 --- a/terraform/transform_module_destroy.go +++ /dev/null @@ -1,37 +0,0 @@ -package terraform - -// ModuleDestroyTransformer is a GraphTransformer that adds a node -// to the graph that will add a module destroy node for all modules in -// the state. -// -// NOTE: This is _completely unnecessary_ in the new graph worlds. This is -// only done to make old tests pass. However, this node does nothing in -// the new apply graph. -type ModuleDestroyTransformer struct { - State *State -} - -func (t *ModuleDestroyTransformer) Transform(g *Graph) error { - // If empty do nothing - if t.State.Empty() { - return nil - } - - for _, ms := range t.State.Modules { - // Just a silly edge case that is required to get old tests to pass. - // It is probably a bug with the old graph but we mimic it here - // so that old tests pass. - if len(ms.Path) <= 1 { - continue - } - - // Create the node - n := &NodeDestroyableModuleVariable{PathValue: ms.Path} - - // Add it to the graph. We don't need any edges because - // it can happen whenever. - g.Add(n) - } - - return nil -}