Skip to content

Commit 6c7cb7a

Browse files
authored
refactor(terraform): simplify AllReferences method signature in Attribute (#8906)
Signed-off-by: nikpivkin <[email protected]>
1 parent 93e6680 commit 6c7cb7a

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

pkg/iac/terraform/attribute.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -718,22 +718,11 @@ func (a *Attribute) ReferencesBlock(b *Block) bool {
718718
return false
719719
}
720720

721-
// nolint
722-
func (a *Attribute) AllReferences(blocks ...*Block) []*Reference {
721+
func (a *Attribute) AllReferences() []*Reference {
723722
if a == nil {
724723
return nil
725724
}
726-
refs := a.referencesFromExpression(a.hclAttribute.Expr)
727-
for _, block := range blocks {
728-
for _, ref := range refs {
729-
if ref.TypeLabel() == "each" {
730-
if forEachAttr := block.GetAttribute("for_each"); forEachAttr.IsNotNil() {
731-
refs = append(refs, forEachAttr.AllReferences()...)
732-
}
733-
}
734-
}
735-
}
736-
return refs
725+
return a.referencesFromExpression(a.hclAttribute.Expr)
737726
}
738727

739728
func (a *Attribute) referencesFromExpression(expr hcl.Expression) []*Reference {

0 commit comments

Comments
 (0)