diff --git a/providers/terraform/resources/tfstate.go b/providers/terraform/resources/tfstate.go index 266b3f0c0b..124777a6dd 100644 --- a/providers/terraform/resources/tfstate.go +++ b/providers/terraform/resources/tfstate.go @@ -5,6 +5,7 @@ package resources import ( "encoding/json" + "errors" "go.mondoo.com/cnquery/llx" "go.mondoo.com/cnquery/providers-sdk/v1/plugin" @@ -24,6 +25,9 @@ func initTerraformState(runtime *plugin.Runtime, args map[string]*llx.RawData) ( if err != nil { return nil, nil, err } + if state == nil { + return nil, nil, errors.New("cannot find state") + } args["formatVersion"] = llx.StringData(state.FormatVersion) args["terraformVersion"] = llx.StringData(state.TerraformVersion)