mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 18:01:01 -06:00
core: legacyDiffComparisonString don't panic if only deposed objects
This shim for the benefit of our old tests was not handling the situation where an InstanceState only contains deposed instances and no current instance. This is a strange, rare situation but one that does come up in practice in some odd cases.
This commit is contained in:
parent
334c6f1c2c
commit
efe956524d
@ -902,6 +902,7 @@ func legacyDiffComparisonString(changes *plans.Changes) string {
|
||||
attrNames := map[string]bool{}
|
||||
var oldAttrs map[string]string
|
||||
var newAttrs map[string]string
|
||||
if rc.Current != nil {
|
||||
if before := rc.Current.Before; before != nil {
|
||||
ty, err := before.ImpliedType()
|
||||
if err == nil {
|
||||
@ -926,6 +927,7 @@ func legacyDiffComparisonString(changes *plans.Changes) string {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if oldAttrs == nil {
|
||||
oldAttrs = make(map[string]string)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user