terraform: tainted apply

This commit is contained in:
Mitchell Hashimoto 2015-02-13 08:50:59 -08:00
parent a3e4b3e966
commit 843cfbe8ad
2 changed files with 48 additions and 3 deletions

View File

@ -3074,8 +3074,7 @@ func TestContext2Apply_countDecreaseToOne(t *testing.T) {
}
}
/*
func TestContextApply_countTainted(t *testing.T) {
func TestContext2Apply_countTainted(t *testing.T) {
m := testModule(t, "apply-count-tainted")
p := testProvider("aws")
p.DiffFn = testDiffFn
@ -3100,7 +3099,7 @@ func TestContextApply_countTainted(t *testing.T) {
},
},
}
ctx := testContext(t, &ContextOpts{
ctx := testContext2(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
@ -3124,6 +3123,7 @@ func TestContextApply_countTainted(t *testing.T) {
}
}
/*
func TestContextApply_countVariable(t *testing.T) {
m := testModule(t, "apply-count-variable")
p := testProvider("aws")

View File

@ -102,5 +102,50 @@ func (n *graphNodeTaintedResource) EvalTree() EvalNode {
},
})
// Apply
var provider ResourceProvider
var diff *InstanceDiff
seq.Nodes = append(seq.Nodes, &EvalOpFilter{
Ops: []walkOperation{walkApply},
Node: &EvalSequence{
Nodes: []EvalNode{
&EvalGetProvider{
Name: n.ProvidedBy()[0],
Output: &provider,
},
&EvalReadState{
Name: n.ResourceName,
Tainted: true,
TaintedIndex: n.Index,
Output: &state,
},
&EvalDiffDestroy{
Info: info,
State: &EvalReadState{
Name: n.ResourceName,
Tainted: true,
TaintedIndex: n.Index,
},
Output: &diff,
},
&EvalApply{
Info: info,
State: &state,
Diff: &diff,
Provider: &provider,
Output: &state,
},
&EvalWriteState{
Name: n.ResourceName,
ResourceType: n.ResourceType,
Dependencies: n.DependentOn(),
State: &state,
Tainted: true,
TaintedIndex: n.Index,
},
},
},
})
return seq
}