Merge pull request #9971 from hashicorp/b-orphan-output
terraform: prune orphan outputs in old graph
This commit is contained in:
commit
9e0af96afa
|
@ -12,7 +12,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/config/module"
|
"github.com/hashicorp/terraform/config/module"
|
||||||
"github.com/hashicorp/terraform/helper/experiment"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestContext2Apply_basic(t *testing.T) {
|
func TestContext2Apply_basic(t *testing.T) {
|
||||||
|
@ -2295,10 +2294,6 @@ func TestContext2Apply_outputOrphan(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContext2Apply_outputOrphanModule(t *testing.T) {
|
func TestContext2Apply_outputOrphanModule(t *testing.T) {
|
||||||
if !experiment.Enabled(experiment.X_newApply) {
|
|
||||||
t.SkipNow()
|
|
||||||
}
|
|
||||||
|
|
||||||
m := testModule(t, "apply-output-orphan-module")
|
m := testModule(t, "apply-output-orphan-module")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyFn = testApplyFn
|
p.ApplyFn = testApplyFn
|
||||||
|
|
|
@ -172,6 +172,9 @@ func (b *BuiltinGraphBuilder) Steps(path []string) []GraphTransformer {
|
||||||
// their dependencies.
|
// their dependencies.
|
||||||
&TargetsTransformer{Targets: b.Targets, Destroy: b.Destroy},
|
&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
|
// Prune the providers. This must happen only once because flattened
|
||||||
// modules might depend on empty providers.
|
// modules might depend on empty providers.
|
||||||
&PruneProviderTransformer{},
|
&PruneProviderTransformer{},
|
||||||
|
|
|
@ -26,7 +26,10 @@ func (n *NodeOutputOrphan) Path() []string {
|
||||||
|
|
||||||
// GraphNodeEvalable
|
// GraphNodeEvalable
|
||||||
func (n *NodeOutputOrphan) EvalTree() EvalNode {
|
func (n *NodeOutputOrphan) EvalTree() EvalNode {
|
||||||
return &EvalDeleteOutput{
|
return &EvalOpFilter{
|
||||||
|
Ops: []walkOperation{walkRefresh, walkApply, walkDestroy},
|
||||||
|
Node: &EvalDeleteOutput{
|
||||||
Name: n.OutputName,
|
Name: n.OutputName,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue