add ChangesSync.FullDestroy
In order to handle various edge cases during a full destroy, add FullDestroy to the synchronized changes so we can attempt to deduce if the plan was created from `terraform destroy`. It's possible that the plan was created by removing all resourced from the configuration, but in that case the end result is the same. Any of the edge cases with provider or destroy provisioner configurations would not apply, since there would not be any configuration references to resolve.
This commit is contained in:
parent
a7e43dfd46
commit
fa8f8df7b6
|
@ -21,6 +21,24 @@ type ChangesSync struct {
|
|||
changes *Changes
|
||||
}
|
||||
|
||||
// FullDestroy returns true if the set of changes indicates we are doing a
|
||||
// destroy of all resources.
|
||||
func (cs *ChangesSync) FullDestroy() bool {
|
||||
if cs == nil {
|
||||
panic("FullDestroy on nil ChangesSync")
|
||||
}
|
||||
cs.lock.Lock()
|
||||
defer cs.lock.Unlock()
|
||||
|
||||
for _, c := range cs.changes.Resources {
|
||||
if c.Action != Delete {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// AppendResourceInstanceChange records the given resource instance change in
|
||||
// the set of planned resource changes.
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue