Skip to content

Commit

Permalink
🐛 fix for terraform <cannot get hcl block> err (#1741)
Browse files Browse the repository at this point in the history
fixes #1737
  • Loading branch information
vjeffrey authored Sep 15, 2023
1 parent 02cf716 commit c5f61bc
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions providers/terraform/resources/hcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,19 @@ func newMqlHclBlock(runtime *plugin.Runtime, block *hcl.Block, file *hcl.File) (

snippet := extractHclCodeSnippet(file, block.TypeRange)

r, err := CreateResource(runtime, "terraform.block", map[string]*llx.RawData{
res, err := CreateResource(runtime, "terraform.block", map[string]*llx.RawData{
"type": llx.StringData(block.Type),
"labels": llx.ArrayData(llx.TArr2Raw(block.Labels), types.String),
"start": llx.ResourceData(start, "terraform.fileposition"),
"end": llx.ResourceData(end, "terraform.fileposition"),
"snippet": llx.StringData(snippet),
})

/*
if err == nil {
r.MqlResource().Cache.Store("_hclblock", &resources.CacheEntry{
Data: block,
})
r.MqlResource().Cache.Store("_hclfile", &resources.CacheEntry{
Data: file,
})
}
*/

if err != nil {
return nil, err
}
r := res.(*mqlTerraformBlock)
r.block = plugin.TValue[*hcl.Block]{State: plugin.StateIsSet, Data: block}
r.cachedFile = plugin.TValue[*hcl.File]{State: plugin.StateIsSet, Data: file}
return r, err
}

Expand Down

0 comments on commit c5f61bc

Please sign in to comment.