github.com/rmenn/terraform@v0.3.8-0.20150225065417-fc84b3a78802/terraform/eval_if.go (about) 1 package terraform 2 3 // EvalIf is an EvalNode that is a conditional. 4 type EvalIf struct { 5 If func(EvalContext) (bool, error) 6 Node EvalNode 7 } 8 9 // TODO: test 10 func (n *EvalIf) Eval(ctx EvalContext) (interface{}, error) { 11 yes, err := n.If(ctx) 12 if err != nil { 13 return nil, err 14 } 15 16 if yes { 17 return EvalRaw(n.Node, ctx) 18 } 19 20 return nil, nil 21 }