Skip to content

Commit

Permalink
🐛 fix panic on uninitialized tf state (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey authored Oct 1, 2023
1 parent 6b1415b commit 280e4b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions providers/terraform/resources/tfstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package resources

import (
"encoding/json"
"errors"

"go.mondoo.com/cnquery/llx"
"go.mondoo.com/cnquery/providers-sdk/v1/plugin"
Expand All @@ -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)
Expand Down

0 comments on commit 280e4b3

Please sign in to comment.