Merge pull request #9971 from hashicorp/b-orphan-output

terraform: prune orphan outputs in old graph
This commit is contained in:
Mitchell Hashimoto 2016-11-09 07:53:15 -08:00 committed by GitHub
commit 9e0af96afa
3 changed files with 8 additions and 7 deletions

View File

@ -12,7 +12,6 @@ import (
"time"
"github.com/hashicorp/terraform/config/module"
"github.com/hashicorp/terraform/helper/experiment"
)
func TestContext2Apply_basic(t *testing.T) {
@ -2295,10 +2294,6 @@ func TestContext2Apply_outputOrphan(t *testing.T) {
}
func TestContext2Apply_outputOrphanModule(t *testing.T) {
if !experiment.Enabled(experiment.X_newApply) {
t.SkipNow()
}
m := testModule(t, "apply-output-orphan-module")
p := testProvider("aws")
p.ApplyFn = testApplyFn

View File

@ -172,6 +172,9 @@ func (b *BuiltinGraphBuilder) Steps(path []string) []GraphTransformer {
// their dependencies.
&TargetsTransformer{Targets: b.Targets, Destroy: b.Destroy},
// Create orphan output nodes
&OrphanOutputTransformer{Module: b.Root, State: b.State},
// Prune the providers. This must happen only once because flattened
// modules might depend on empty providers.
&PruneProviderTransformer{},

View File

@ -26,7 +26,10 @@ func (n *NodeOutputOrphan) Path() []string {
// GraphNodeEvalable
func (n *NodeOutputOrphan) EvalTree() EvalNode {
return &EvalDeleteOutput{
return &EvalOpFilter{
Ops: []walkOperation{walkRefresh, walkApply, walkDestroy},
Node: &EvalDeleteOutput{
Name: n.OutputName,
},
}
}