2018-02-02 19:22:25 -06:00
|
|
|
package configs
|
|
|
|
|
|
|
|
import (
|
2019-09-09 17:58:44 -05:00
|
|
|
"github.com/hashicorp/hcl/v2"
|
2018-02-02 19:22:25 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func decodeDependsOn(attr *hcl.Attribute) ([]hcl.Traversal, hcl.Diagnostics) {
|
|
|
|
var ret []hcl.Traversal
|
|
|
|
exprs, diags := hcl.ExprList(attr.Expr)
|
|
|
|
|
|
|
|
for _, expr := range exprs {
|
2018-02-15 12:17:36 -06:00
|
|
|
expr, shimDiags := shimTraversalInString(expr, false)
|
|
|
|
diags = append(diags, shimDiags...)
|
2018-02-02 19:22:25 -06:00
|
|
|
|
|
|
|
traversal, travDiags := hcl.AbsTraversalForExpr(expr)
|
|
|
|
diags = append(diags, travDiags...)
|
|
|
|
if len(traversal) != 0 {
|
|
|
|
ret = append(ret, traversal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret, diags
|
|
|
|
}
|