code: func interpolationFuncLookup(vs map[string]ast.Variable) ast.Function {
  	return ast.Function{
  		ArgTypes:     []ast.Type{ast.TypeMap, ast.TypeString},
  		ReturnType:   ast.TypeString,
  		Variadic:     true,
  		VariadicType: ast.TypeString,
  		Callback: func(args []interface{}) (interface{}, error) {
  			defaultValue := ""
  			defaultValueSet := false
  			if len(args) > 2 {
  				defaultValue = args[2].(string)
  				defaultValueSet = true
  			}
  			if len(args) > 3 {
  				return "", fmt.Errorf("lookup() takes no more than three arguments")
  			}
  			index := args[1].(string)
  			mapVar := args[0].(map[string]ast.Variable)
  
  			v, ok := mapVar[index]
  			if !ok {
  				if defaultValueSet {
  					return defaultValue, nil
  				} else {
  					return "", fmt.Errorf(
  						"lookup failed to find '%s'",
  						args[1].(string))
  				}
  			}
  			if v.Type != ast.TypeString {
  				return nil, fmt.Errorf(
  					"lookup() may only be used with flat maps, this map contains elements of %s",
  					v.Type.Printable())
  			}
  
  			return v.Value.(string), nil
  		},
  	}
  }
docs: // interpolationFuncLookup implements the "lookup" function that allows
  // dynamic lookups of map types within a Terraform configuration.