From d344676e8c94359e0d33b2a0cc107c116a2e45c6 Mon Sep 17 00:00:00 2001 From: Olivier Date: Wed, 2 Aug 2023 15:37:05 +0200 Subject: [PATCH] Fix: case when resource is nil --- internal/plan/resources.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/plan/resources.go b/internal/plan/resources.go index c103c40..944bcd5 100644 --- a/internal/plan/resources.go +++ b/internal/plan/resources.go @@ -32,11 +32,15 @@ func GetResources(tfPlan *tfjson.Plan) (map[string]resources.Resource, error) { if priorRes.Mode == "data" { if strings.HasPrefix(priorRes.Type, "google") { dataResource := gcp.GetDataResource(*priorRes) - terraformRefs.DataResources[dataResource.GetKey()] = dataResource + if dataResource != nil { + terraformRefs.DataResources[dataResource.GetKey()] = dataResource + } } if strings.HasPrefix(priorRes.Type, "aws") { dataResource := aws.GetDataResource(*priorRes) - terraformRefs.DataResources[dataResource.GetKey()] = dataResource + if dataResource != nil { + terraformRefs.DataResources[dataResource.GetKey()] = dataResource + } } } }