Skip to content

Commit

Permalink
🐛 fix for terraform <cannot get hcl block> err
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey committed Sep 15, 2023
1 parent 266ac98 commit 6124ea9
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions providers/terraform/resources/hcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,24 +172,16 @@ 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,
})
}
*/
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 6124ea9

Please sign in to comment.