Skip to content

Commit

Permalink
chore(terraform): add accessors to underlying raw hcl values (#8306)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emyrk authored Jan 30, 2025
1 parent 2e8e38a commit 87f3751
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/iac/scanners/terraform/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func (p *Parser) newModuleParser(moduleFS fs.FS, moduleSource, modulePath, modul
return mp
}

func (p *Parser) Files() map[string]*hcl.File {
return p.underlying.Files()
}

func (p *Parser) ParseFile(_ context.Context, fullPath string) error {

isJSON := strings.HasSuffix(fullPath, ".tf.json")
Expand Down
4 changes: 4 additions & 0 deletions pkg/iac/terraform/attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func NewAttribute(attr *hcl.Attribute, ctx *context.Context, module string, pare
}
}

func (a *Attribute) HCLAttribute() *hcl.Attribute {
return a.hclAttribute
}

func (a *Attribute) GetMetadata() iacTypes.Metadata {
return a.metadata
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/iac/terraform/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ func NewBlock(hclBlock *hcl.Block, ctx *context.Context, moduleBlock *Block, par
return &b
}

func (b *Block) HCLBlock() *hcl.Block {
return b.hclBlock
}

func (b *Block) ID() string {
return b.id
}
Expand Down

0 comments on commit 87f3751

Please sign in to comment.