refactor(terraform): simplify AllReferences method signature in Attribute (#8906)

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
Nikita Pivkin
2025-05-24 06:09:04 +06:00
committed by GitHub
parent 93e6680b1c
commit 6c7cb7ad2d

View File

@@ -718,22 +718,11 @@ func (a *Attribute) ReferencesBlock(b *Block) bool {
return false
}
// nolint
func (a *Attribute) AllReferences(blocks ...*Block) []*Reference {
func (a *Attribute) AllReferences() []*Reference {
if a == nil {
return nil
}
refs := a.referencesFromExpression(a.hclAttribute.Expr)
for _, block := range blocks {
for _, ref := range refs {
if ref.TypeLabel() == "each" {
if forEachAttr := block.GetAttribute("for_each"); forEachAttr.IsNotNil() {
refs = append(refs, forEachAttr.AllReferences()...)
}
}
}
}
return refs
return a.referencesFromExpression(a.hclAttribute.Expr)
}
func (a *Attribute) referencesFromExpression(expr hcl.Expression) []*Reference {