mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Fixes crash #21896
Fix for a crash during terraform plan: If there is a multi-instance resource (count > 1) where one of the instances was deleted in the deployment but was still present in the terraform state, getResourceInstancesAll crashed. Check not only for rs.Instances[key] to exist, but also to have a valid Current pointer.
This commit is contained in:
parent
dbcd9a5625
commit
a22891deba
@ -696,7 +696,7 @@ func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng t
|
|||||||
ty := schema.ImpliedType()
|
ty := schema.ImpliedType()
|
||||||
key := addrs.IntKey(i)
|
key := addrs.IntKey(i)
|
||||||
is, exists := rs.Instances[key]
|
is, exists := rs.Instances[key]
|
||||||
if exists {
|
if exists && is.Current != nil {
|
||||||
instAddr := addr.Instance(key).Absolute(d.ModulePath)
|
instAddr := addr.Instance(key).Absolute(d.ModulePath)
|
||||||
|
|
||||||
// Prefer pending value in plan if present. See getResourceInstanceSingle
|
// Prefer pending value in plan if present. See getResourceInstanceSingle
|
||||||
|
Loading…
Reference in New Issue
Block a user