github.com/KevinKlinger/open_terraform@v0.11.12-beta1/configs/depends_on.go (about)

     1  package configs
     2  
     3  import (
     4  	"github.com/hashicorp/hcl2/hcl"
     5  )
     6  
     7  func decodeDependsOn(attr *hcl.Attribute) ([]hcl.Traversal, hcl.Diagnostics) {
     8  	var ret []hcl.Traversal
     9  	exprs, diags := hcl.ExprList(attr.Expr)
    10  
    11  	for _, expr := range exprs {
    12  		expr, shimDiags := shimTraversalInString(expr, false)
    13  		diags = append(diags, shimDiags...)
    14  
    15  		traversal, travDiags := hcl.AbsTraversalForExpr(expr)
    16  		diags = append(diags, travDiags...)
    17  		if len(traversal) != 0 {
    18  			ret = append(ret, traversal)
    19  		}
    20  	}
    21  
    22  	return ret, diags
    23  }