4 "github.com/hashicorp/hil/ast"
7 // FixedValueTransform transforms an AST to return a fixed value for
8 // all interpolations. i.e. you can make "hi ${anything}" always
11 // The primary use case for this is for config validations where you can
12 // verify that interpolations result in a certain type of string.
13 func FixedValueTransform(root ast.Node, Value *ast.LiteralNode) ast.Node {
14 // We visit the nodes in top-down order
16 switch n := result.(type) {
18 for i, v := range n.Exprs {
19 n.Exprs[i] = FixedValueTransform(v, Value)
21 case *ast.LiteralNode:
24 // Anything else we replace