github.com/hashicorp/hcl/v2@v2.20.0/ext/userfunc/doc.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 // Package userfunc implements a HCL extension that allows user-defined 5 // functions in HCL configuration. 6 // 7 // Using this extension requires some integration effort on the part of the 8 // calling application, to pass any declared functions into a HCL evaluation 9 // context after processing. 10 // 11 // The function declaration syntax looks like this: 12 // 13 // function "foo" { 14 // params = ["name"] 15 // result = "Hello, ${name}!" 16 // } 17 // 18 // When a user-defined function is called, the expression given for the "result" 19 // attribute is evaluated in an isolated evaluation context that defines variables 20 // named after the given parameter names. 21 // 22 // The block name "function" may be overridden by the calling application, if 23 // that default name conflicts with an existing block or attribute name in 24 // the application. 25 package userfunc