states: SyncState.ResourceInstanceObjectFull tolerate missing resource

This was previously dealing okay with the case where a resource doesn't
have the requested instance, but was not handling the situation where the
resource doesn't exist at all yet.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
Martin Atkins
2025-12-11 16:21:05 -08:00
parent e879e9060f
commit f36fd65dbd

View File

@@ -84,6 +84,9 @@ func (s *SyncState) ResourceInstanceObjectFull(addr addrs.AbsResourceInstance, d
defer s.lock.RUnlock()
rsrc := s.state.Resource(addr.ContainingResource())
if rsrc == nil {
return nil
}
inst := rsrc.Instances[addr.Resource.Key]
if inst == nil {
return nil