terraform: planning tainted resources works

This commit is contained in:
Mitchell Hashimoto 2014-09-19 22:35:29 -06:00
parent 157843725d
commit 10b5661bc3
2 changed files with 11 additions and 5 deletions

View File

@ -759,6 +759,11 @@ func (c *Context) planWalkFn(result *Plan) depgraph.WalkFunc {
result.init()
cb := func(r *Resource) error {
if r.Tainted && r.TaintedIndex > -1 {
// No-op this. We somewhat magically diff this later.
return nil
}
var diff *InstanceDiff
is := r.State.Primary
@ -895,7 +900,7 @@ func (c *Context) planDestroyWalkFn(result *Plan) depgraph.WalkFunc {
func (c *Context) refreshWalkFn() depgraph.WalkFunc {
cb := func(r *Resource) error {
is := r.State.Primary
if r.Tainted {
if r.Tainted && r.TaintedIndex > -1 {
is = r.State.Tainted[r.TaintedIndex]
}

View File

@ -271,10 +271,11 @@ func graphAddConfigResources(
Type: r.Type,
Config: r,
Resource: &Resource{
Id: name,
State: state,
Config: NewResourceConfig(r.RawConfig),
Tainted: len(state.Tainted) > 0,
Id: name,
State: state,
Config: NewResourceConfig(r.RawConfig),
Tainted: len(state.Tainted) > 0,
TaintedIndex: -1,
},
},
}