use CreateBeforeDestroy from state
If the resource was stored as CreateBeforeDestroy, use the same ordering regardless. This reversal will be taken care if more cleanly in state-only destroys, and with less risk. Don't use this commit as-is.
This commit is contained in:
parent
a44cf03eaa
commit
691bb6b907
|
@ -56,12 +56,21 @@ func (n *NodeDestroyResourceInstance) CreateBeforeDestroy() bool {
|
||||||
return *n.CreateBeforeDestroyOverride
|
return *n.CreateBeforeDestroyOverride
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have no config, we just assume no
|
// Config takes precedence
|
||||||
if n.Config == nil || n.Config.Managed == nil {
|
if n.Config != nil && n.Config.Managed != nil {
|
||||||
return false
|
return n.Config.Managed.CreateBeforeDestroy
|
||||||
}
|
}
|
||||||
|
|
||||||
return n.Config.Managed.CreateBeforeDestroy
|
// Otherwise check the state for a stored destroy order
|
||||||
|
if rs := n.ResourceState; rs != nil {
|
||||||
|
if s := rs.Instance(n.InstanceKey); s != nil {
|
||||||
|
if s.Current != nil {
|
||||||
|
return s.Current.CreateBeforeDestroy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphNodeDestroyerCBD
|
// GraphNodeDestroyerCBD
|
||||||
|
|
Loading…
Reference in New Issue