terraform: fix issues with tainted marking
This commit is contained in:
parent
62511c0ccb
commit
86903eb18f
|
@ -592,6 +592,8 @@ func (c *Context) applyWalkFn() depgraph.WalkFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
if tainted {
|
if tainted {
|
||||||
|
log.Printf("[DEBUG] %s: Marking as tainted", r.Id)
|
||||||
|
|
||||||
c.sl.Lock()
|
c.sl.Lock()
|
||||||
c.state.Tainted[r.Id] = struct{}{}
|
c.state.Tainted[r.Id] = struct{}{}
|
||||||
c.sl.Unlock()
|
c.sl.Unlock()
|
||||||
|
@ -599,6 +601,7 @@ func (c *Context) applyWalkFn() depgraph.WalkFunc {
|
||||||
|
|
||||||
// Update the state for the resource itself
|
// Update the state for the resource itself
|
||||||
r.State = rs
|
r.State = rs
|
||||||
|
r.Tainted = tainted
|
||||||
|
|
||||||
for _, h := range c.hooks {
|
for _, h := range c.hooks {
|
||||||
handleHook(h.PostApply(r.Id, r.State, applyerr))
|
handleHook(h.PostApply(r.Id, r.State, applyerr))
|
||||||
|
@ -721,6 +724,7 @@ func (c *Context) planWalkFn(result *Plan) depgraph.WalkFunc {
|
||||||
|
|
||||||
if r.Tainted {
|
if r.Tainted {
|
||||||
// Tainted resources must also be destroyed
|
// Tainted resources must also be destroyed
|
||||||
|
log.Printf("[DEBUG] %s: Tainted, marking for destroy", r.Id)
|
||||||
diff.Destroy = true
|
diff.Destroy = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,9 @@ func (s *State) deepcopy() *State {
|
||||||
for k, v := range s.Resources {
|
for k, v := range s.Resources {
|
||||||
result.Resources[k] = v
|
result.Resources[k] = v
|
||||||
}
|
}
|
||||||
|
for k, v := range s.Tainted {
|
||||||
|
result.Tainted[k] = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue