github.com/opentofu/opentofu@v1.7.1/internal/lang/funcs/descriptions.go (about) 1 // Copyright (c) The OpenTofu Authors 2 // SPDX-License-Identifier: MPL-2.0 3 // Copyright (c) 2023 HashiCorp, Inc. 4 // SPDX-License-Identifier: MPL-2.0 5 6 package funcs 7 8 import "github.com/zclconf/go-cty/cty/function" 9 10 type descriptionEntry struct { 11 // Description is a description for the function. 12 Description string 13 14 // ParamDescription argument must match the number of parameters of the 15 // function. If the function has a VarParam then that counts as one 16 // parameter. The given descriptions will be assigned in order starting 17 // with the positional arguments in their declared order, followed by the 18 // variadic parameter if any. 19 ParamDescription []string 20 } 21 22 // DescriptionList is a consolidated list containing all descriptions for all 23 // functions available within OpenTofu. A function's description should point 24 // to the matching entry in this list. 25 // 26 // We keep this as a single list, so we can quickly review descriptions within 27 // a single file and copy the whole list to other projects, like 28 // terraform-schema. 29 var DescriptionList = map[string]descriptionEntry{ 30 "abs": { 31 Description: "`abs` returns the absolute value of the given number. In other words, if the number is zero or positive then it is returned as-is, but if it is negative then it is multiplied by -1 to make it positive before returning it.", 32 ParamDescription: []string{""}, 33 }, 34 "abspath": { 35 Description: "`abspath` takes a string containing a filesystem path and converts it to an absolute path. That is, if the path is not absolute, it will be joined with the current working directory.", 36 ParamDescription: []string{""}, 37 }, 38 "alltrue": { 39 Description: "`alltrue` returns `true` if all elements in a given collection are `true` or `\"true\"`. It also returns `true` if the collection is empty.", 40 ParamDescription: []string{""}, 41 }, 42 "anytrue": { 43 Description: "`anytrue` returns `true` if any element in a given collection is `true` or `\"true\"`. It also returns `false` if the collection is empty.", 44 ParamDescription: []string{""}, 45 }, 46 "base64decode": { 47 Description: "`base64decode` takes a string containing a Base64 character sequence and returns the original string.", 48 ParamDescription: []string{""}, 49 }, 50 "base64encode": { 51 Description: "`base64encode` applies Base64 encoding to a string.", 52 ParamDescription: []string{""}, 53 }, 54 "base64gzip": { 55 Description: "`base64gzip` compresses a string with gzip and then encodes the result in Base64 encoding.", 56 ParamDescription: []string{""}, 57 }, 58 "base64gunzip": { 59 Description: "`base64gunzip` decodes a Base64-encoded string and uncompresses the result with gzip.", 60 ParamDescription: []string{""}, 61 }, 62 "base64sha256": { 63 Description: "`base64sha256` computes the SHA256 hash of a given string and encodes it with Base64. This is not equivalent to `base64encode(sha256(\"test\"))` since `sha256()` returns hexadecimal representation.", 64 ParamDescription: []string{""}, 65 }, 66 "base64sha512": { 67 Description: "`base64sha512` computes the SHA512 hash of a given string and encodes it with Base64. This is not equivalent to `base64encode(sha512(\"test\"))` since `sha512()` returns hexadecimal representation.", 68 ParamDescription: []string{""}, 69 }, 70 "basename": { 71 Description: "`basename` takes a string containing a filesystem path and removes all except the last portion from it.", 72 ParamDescription: []string{""}, 73 }, 74 "bcrypt": { 75 Description: "`bcrypt` computes a hash of the given string using the Blowfish cipher, returning a string in [the _Modular Crypt Format_](https://passlib.readthedocs.io/en/stable/modular_crypt_format.html) usually expected in the shadow password file on many Unix systems.", 76 ParamDescription: []string{ 77 "", 78 "The `cost` argument is optional and will default to 10 if unspecified.", 79 }, 80 }, 81 "can": { 82 Description: "`can` evaluates the given expression and returns a boolean value indicating whether the expression produced a result without any errors.", 83 ParamDescription: []string{""}, 84 }, 85 "ceil": { 86 Description: "`ceil` returns the closest whole number that is greater than or equal to the given value, which may be a fraction.", 87 ParamDescription: []string{""}, 88 }, 89 "chomp": { 90 Description: "`chomp` removes newline characters at the end of a string.", 91 ParamDescription: []string{""}, 92 }, 93 "chunklist": { 94 Description: "`chunklist` splits a single list into fixed-size chunks, returning a list of lists.", 95 ParamDescription: []string{ 96 "", 97 "The maximum length of each chunk. All but the last element of the result is guaranteed to be of exactly this size.", 98 }, 99 }, 100 "cidrcontains": { 101 Description: "`cidrcontains` determines whether a given IP address or an address prefix given in CIDR notation is within a given IP network address prefix.", 102 ParamDescription: []string{ 103 "`containing_prefix` must be given in CIDR notation, as defined in [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1).", 104 "`contained_ip_or_prefix` is either an IP address or an address prefix given in CIDR notation.", 105 }, 106 }, 107 "cidrhost": { 108 Description: "`cidrhost` calculates a full host IP address for a given host number within a given IP network address prefix.", 109 ParamDescription: []string{ 110 "`prefix` must be given in CIDR notation, as defined in [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1).", 111 "`hostnum` is a whole number that can be represented as a binary integer with no more than the number of digits remaining in the address after the given prefix.", 112 }, 113 }, 114 "cidrnetmask": { 115 Description: "`cidrnetmask` converts an IPv4 address prefix given in CIDR notation into a subnet mask address.", 116 ParamDescription: []string{ 117 "`prefix` must be given in CIDR notation, as defined in [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1).", 118 }, 119 }, 120 "cidrsubnet": { 121 Description: "`cidrsubnet` calculates a subnet address within given IP network address prefix.", 122 ParamDescription: []string{ 123 "`prefix` must be given in CIDR notation, as defined in [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1).", 124 "`newbits` is the number of additional bits with which to extend the prefix.", 125 "`netnum` is a whole number that can be represented as a binary integer with no more than `newbits` binary digits, which will be used to populate the additional bits added to the prefix."}, 126 }, 127 "cidrsubnets": { 128 Description: "`cidrsubnets` calculates a sequence of consecutive IP address ranges within a particular CIDR prefix.", 129 ParamDescription: []string{ 130 "`prefix` must be given in CIDR notation, as defined in [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1).", 131 "", 132 }, 133 }, 134 "coalesce": { 135 Description: "`coalesce` takes any number of arguments and returns the first one that isn't null or an empty string.", 136 ParamDescription: []string{""}, 137 }, 138 "coalescelist": { 139 Description: "`coalescelist` takes any number of list arguments and returns the first one that isn't empty.", 140 ParamDescription: []string{ 141 "List or tuple values to test in the given order.", 142 }, 143 }, 144 "compact": { 145 Description: "`compact` takes a list of strings and returns a new list with any empty string elements removed.", 146 ParamDescription: []string{""}, 147 }, 148 "concat": { 149 Description: "`concat` takes two or more lists and combines them into a single list.", 150 ParamDescription: []string{""}, 151 }, 152 "contains": { 153 Description: "`contains` determines whether a given list or set contains a given single value as one of its elements.", 154 ParamDescription: []string{"", ""}, 155 }, 156 "csvdecode": { 157 Description: "`csvdecode` decodes a string containing CSV-formatted data and produces a list of maps representing that data.", 158 ParamDescription: []string{""}, 159 }, 160 "dirname": { 161 Description: "`dirname` takes a string containing a filesystem path and removes the last portion from it.", 162 ParamDescription: []string{""}, 163 }, 164 "distinct": { 165 Description: "`distinct` takes a list and returns a new list with any duplicate elements removed.", 166 ParamDescription: []string{""}, 167 }, 168 "element": { 169 Description: "`element` retrieves a single element from a list.", 170 ParamDescription: []string{"", ""}, 171 }, 172 "endswith": { 173 Description: "`endswith` takes two values: a string to check and a suffix string. The function returns true if the first string ends with that exact suffix.", 174 ParamDescription: []string{"", ""}, 175 }, 176 "file": { 177 Description: "`file` reads the contents of a file at the given path and returns them as a string.", 178 ParamDescription: []string{""}, 179 }, 180 "filebase64": { 181 Description: "`filebase64` reads the contents of a file at the given path and returns them as a base64-encoded string.", 182 ParamDescription: []string{""}, 183 }, 184 "filebase64sha256": { 185 Description: "`filebase64sha256` is a variant of `base64sha256` that hashes the contents of a given file rather than a literal string.", 186 ParamDescription: []string{""}, 187 }, 188 "filebase64sha512": { 189 Description: "`filebase64sha512` is a variant of `base64sha512` that hashes the contents of a given file rather than a literal string.", 190 ParamDescription: []string{""}, 191 }, 192 "fileexists": { 193 Description: "`fileexists` determines whether a file exists at a given path.", 194 ParamDescription: []string{""}, 195 }, 196 "filemd5": { 197 Description: "`filemd5` is a variant of `md5` that hashes the contents of a given file rather than a literal string.", 198 ParamDescription: []string{""}, 199 }, 200 "fileset": { 201 Description: "`fileset` enumerates a set of regular file names given a path and pattern. The path is automatically removed from the resulting set of file names and any result still containing path separators always returns forward slash (`/`) as the path separator for cross-system compatibility.", 202 ParamDescription: []string{"", ""}, 203 }, 204 "filesha1": { 205 Description: "`filesha1` is a variant of `sha1` that hashes the contents of a given file rather than a literal string.", 206 ParamDescription: []string{""}, 207 }, 208 "filesha256": { 209 Description: "`filesha256` is a variant of `sha256` that hashes the contents of a given file rather than a literal string.", 210 ParamDescription: []string{""}, 211 }, 212 "filesha512": { 213 Description: "`filesha512` is a variant of `sha512` that hashes the contents of a given file rather than a literal string.", 214 ParamDescription: []string{""}, 215 }, 216 "flatten": { 217 Description: "`flatten` takes a list and replaces any elements that are lists with a flattened sequence of the list contents.", 218 ParamDescription: []string{""}, 219 }, 220 "floor": { 221 Description: "`floor` returns the closest whole number that is less than or equal to the given value, which may be a fraction.", 222 ParamDescription: []string{""}, 223 }, 224 "format": { 225 Description: "The `format` function produces a string by formatting a number of other values according to a specification string. It is similar to the `printf` function in C, and other similar functions in other programming languages.", 226 ParamDescription: []string{"", ""}, 227 }, 228 "formatdate": { 229 Description: "`formatdate` converts a timestamp into a different time format.", 230 ParamDescription: []string{"", ""}, 231 }, 232 "formatlist": { 233 Description: "`formatlist` produces a list of strings by formatting a number of other values according to a specification string.", 234 ParamDescription: []string{"", ""}, 235 }, 236 "indent": { 237 Description: "`indent` adds a given number of spaces to the beginnings of all but the first line in a given multi-line string.", 238 ParamDescription: []string{ 239 "Number of spaces to add after each newline character.", 240 "", 241 }, 242 }, 243 "index": { 244 Description: "`index` finds the element index for a given value in a list.", 245 ParamDescription: []string{"", ""}, 246 }, 247 "issensitive": { 248 Description: "`issensitive` takes any value and returns `true` if the value is marked as sensitive, and `false` otherwise.", 249 ParamDescription: []string{""}, 250 }, 251 "join": { 252 Description: "`join` produces a string by concatenating together all elements of a given list of strings with the given delimiter.", 253 ParamDescription: []string{ 254 "Delimiter to insert between the given strings.", 255 "One or more lists of strings to join.", 256 }, 257 }, 258 "jsondecode": { 259 Description: "`jsondecode` interprets a given string as JSON, returning a representation of the result of decoding that string.", 260 ParamDescription: []string{""}, 261 }, 262 "jsonencode": { 263 Description: "`jsonencode` encodes a given value to a string using JSON syntax.", 264 ParamDescription: []string{""}, 265 }, 266 "keys": { 267 Description: "`keys` takes a map and returns a list containing the keys from that map.", 268 ParamDescription: []string{ 269 "The map to extract keys from. May instead be an object-typed value, in which case the result is a tuple of the object attributes.", 270 }, 271 }, 272 "length": { 273 Description: "`length` determines the length of a given list, map, or string.", 274 ParamDescription: []string{""}, 275 }, 276 "list": { 277 Description: "The `list` function is no longer available. See `tolist` instead.", 278 ParamDescription: []string{""}, 279 }, 280 "log": { 281 Description: "`log` returns the logarithm of a given number in a given base.", 282 ParamDescription: []string{"", ""}, 283 }, 284 "lookup": { 285 Description: "`lookup` retrieves the value of a single element from a map, given its key. If the given key does not exist, the given default value is returned instead.", 286 ParamDescription: []string{"", "", ""}, 287 }, 288 "lower": { 289 Description: "`lower` converts all cased letters in the given string to lowercase.", 290 ParamDescription: []string{""}, 291 }, 292 "map": { 293 Description: "The `map` function is no longer available. See `tomap` instead.", 294 ParamDescription: []string{""}, 295 }, 296 "matchkeys": { 297 Description: "`matchkeys` constructs a new list by taking a subset of elements from one list whose indexes match the corresponding indexes of values in another list.", 298 ParamDescription: []string{"", "", ""}, 299 }, 300 "max": { 301 Description: "`max` takes one or more numbers and returns the greatest number from the set.", 302 ParamDescription: []string{""}, 303 }, 304 "md5": { 305 Description: "`md5` computes the MD5 hash of a given string and encodes it with hexadecimal digits.", 306 ParamDescription: []string{""}, 307 }, 308 "merge": { 309 Description: "`merge` takes an arbitrary number of maps or objects, and returns a single map or object that contains a merged set of elements from all arguments.", 310 ParamDescription: []string{""}, 311 }, 312 "min": { 313 Description: "`min` takes one or more numbers and returns the smallest number from the set.", 314 ParamDescription: []string{""}, 315 }, 316 "nonsensitive": { 317 Description: "`nonsensitive` takes a sensitive value and returns a copy of that value with the sensitive marking removed, thereby exposing the sensitive value.", 318 ParamDescription: []string{""}, 319 }, 320 "one": { 321 Description: "`one` takes a list, set, or tuple value with either zero or one elements. If the collection is empty, `one` returns `null`. Otherwise, `one` returns the first element. If there are two or more elements then `one` will return an error.", 322 ParamDescription: []string{""}, 323 }, 324 "parseint": { 325 Description: "`parseint` parses the given string as a representation of an integer in the specified base and returns the resulting number. The base must be between 2 and 62 inclusive.", 326 ParamDescription: []string{"", ""}, 327 }, 328 "pathexpand": { 329 Description: "`pathexpand` takes a filesystem path that might begin with a `~` segment, and if so it replaces that segment with the current user's home directory path.", 330 ParamDescription: []string{""}, 331 }, 332 "pow": { 333 Description: "`pow` calculates an exponent, by raising its first argument to the power of the second argument.", 334 ParamDescription: []string{"", ""}, 335 }, 336 "range": { 337 Description: "`range` generates a list of numbers using a start value, a limit value, and a step value.", 338 ParamDescription: []string{""}, 339 }, 340 "regex": { 341 Description: "`regex` applies a [regular expression](https://en.wikipedia.org/wiki/Regular_expression) to a string and returns the matching substrings.", 342 ParamDescription: []string{"", ""}, 343 }, 344 "regexall": { 345 Description: "`regexall` applies a [regular expression](https://en.wikipedia.org/wiki/Regular_expression) to a string and returns a list of all matches.", 346 ParamDescription: []string{"", ""}, 347 }, 348 "replace": { 349 Description: "`replace` searches a given string for another given substring, and replaces each occurrence with a given replacement string.", 350 ParamDescription: []string{"", "", ""}, 351 }, 352 "reverse": { 353 Description: "`reverse` takes a sequence and produces a new sequence of the same length with all of the same elements as the given sequence but in reverse order.", 354 ParamDescription: []string{""}, 355 }, 356 "rsadecrypt": { 357 Description: "`rsadecrypt` decrypts an RSA-encrypted ciphertext, returning the corresponding cleartext.", 358 ParamDescription: []string{"", ""}, 359 }, 360 "sensitive": { 361 Description: "`sensitive` takes any value and returns a copy of it marked so that OpenTofu will treat it as sensitive, with the same meaning and behavior as for [sensitive input variables](/language/values/variables#suppressing-values-in-cli-output).", 362 ParamDescription: []string{""}, 363 }, 364 "setintersection": { 365 Description: "The `setintersection` function takes multiple sets and produces a single set containing only the elements that all of the given sets have in common. In other words, it computes the [intersection](https://en.wikipedia.org/wiki/Intersection_\\(set_theory\\)) of the sets.", 366 ParamDescription: []string{"", ""}, 367 }, 368 "setproduct": { 369 Description: "The `setproduct` function finds all of the possible combinations of elements from all of the given sets by computing the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product).", 370 ParamDescription: []string{ 371 "The sets to consider. Also accepts lists and tuples, and if all arguments are of list or tuple type then the result will preserve the input ordering", 372 }, 373 }, 374 "setsubtract": { 375 Description: "The `setsubtract` function returns a new set containing the elements from the first set that are not present in the second set. In other words, it computes the [relative complement](https://en.wikipedia.org/wiki/Complement_\\(set_theory\\)#Relative_complement) of the second set.", 376 ParamDescription: []string{"", ""}, 377 }, 378 "setunion": { 379 Description: "The `setunion` function takes multiple sets and produces a single set containing the elements from all of the given sets. In other words, it computes the [union](https://en.wikipedia.org/wiki/Union_\\(set_theory\\)) of the sets.", 380 ParamDescription: []string{"", ""}, 381 }, 382 "sha1": { 383 Description: "`sha1` computes the SHA1 hash of a given string and encodes it with hexadecimal digits.", 384 ParamDescription: []string{""}, 385 }, 386 "sha256": { 387 Description: "`sha256` computes the SHA256 hash of a given string and encodes it with hexadecimal digits.", 388 ParamDescription: []string{""}, 389 }, 390 "sha512": { 391 Description: "`sha512` computes the SHA512 hash of a given string and encodes it with hexadecimal digits.", 392 ParamDescription: []string{""}, 393 }, 394 "signum": { 395 Description: "`signum` determines the sign of a number, returning a number between -1 and 1 to represent the sign.", 396 ParamDescription: []string{""}, 397 }, 398 "slice": { 399 Description: "`slice` extracts some consecutive elements from within a list.", 400 ParamDescription: []string{"", "", ""}, 401 }, 402 "sort": { 403 Description: "`sort` takes a list of strings and returns a new list with those strings sorted lexicographically.", 404 ParamDescription: []string{""}, 405 }, 406 "split": { 407 Description: "`split` produces a list by dividing a given string at all occurrences of a given separator.", 408 ParamDescription: []string{"", ""}, 409 }, 410 "startswith": { 411 Description: "`startswith` takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix.", 412 ParamDescription: []string{"", ""}, 413 }, 414 "strcontains": { 415 Description: "`strcontains` takes two values: a string to check and an expected substring. The function returns true if the string has the substring contained within it.", 416 ParamDescription: []string{"", ""}, 417 }, 418 "strrev": { 419 Description: "`strrev` reverses the characters in a string. Note that the characters are treated as _Unicode characters_ (in technical terms, Unicode [grapheme cluster boundaries](https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) are respected).", 420 ParamDescription: []string{""}, 421 }, 422 "substr": { 423 Description: "`substr` extracts a substring from a given string by offset and (maximum) length.", 424 ParamDescription: []string{"", "", ""}, 425 }, 426 "sum": { 427 Description: "`sum` takes a list or set of numbers and returns the sum of those numbers.", 428 ParamDescription: []string{""}, 429 }, 430 "templatefile": { 431 Description: "`templatefile` reads the file at the given path and renders its content as a template using a supplied set of template variables.", 432 ParamDescription: []string{"", ""}, 433 }, 434 "templatestring": { 435 Description: "`templatestring` processes the provided string as a template using a supplied set of template variables.", 436 ParamDescription: []string{"", ""}, 437 }, 438 "textdecodebase64": { 439 Description: "`textdecodebase64` function decodes a string that was previously Base64-encoded, and then interprets the result as characters in a specified character encoding.", 440 ParamDescription: []string{"", ""}, 441 }, 442 "textencodebase64": { 443 Description: "`textencodebase64` encodes the unicode characters in a given string using a specified character encoding, returning the result base64 encoded because OpenTofu language strings are always sequences of unicode characters.", 444 ParamDescription: []string{"", ""}, 445 }, 446 "timeadd": { 447 Description: "`timeadd` adds a duration to a timestamp, returning a new timestamp.", 448 ParamDescription: []string{"", ""}, 449 }, 450 "timecmp": { 451 Description: "`timecmp` compares two timestamps and returns a number that represents the ordering of the instants those timestamps represent.", 452 ParamDescription: []string{"", ""}, 453 }, 454 "timestamp": { 455 Description: "`timestamp` returns a UTC timestamp string in [RFC 3339](https://tools.ietf.org/html/rfc3339) format.", 456 ParamDescription: []string{}, 457 }, 458 "plantimestamp": { 459 Description: "`plantimestamp` returns a UTC timestamp string in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, fixed to a constant time representing the time of the plan.", 460 ParamDescription: []string{}, 461 }, 462 "title": { 463 Description: "`title` converts the first letter of each word in the given string to uppercase.", 464 ParamDescription: []string{""}, 465 }, 466 "tobool": { 467 Description: "`tobool` converts its argument to a boolean value.", 468 ParamDescription: []string{""}, 469 }, 470 "tolist": { 471 Description: "`tolist` converts its argument to a list value.", 472 ParamDescription: []string{""}, 473 }, 474 "tomap": { 475 Description: "`tomap` converts its argument to a map value.", 476 ParamDescription: []string{""}, 477 }, 478 "tonumber": { 479 Description: "`tonumber` converts its argument to a number value.", 480 ParamDescription: []string{""}, 481 }, 482 "toset": { 483 Description: "`toset` converts its argument to a set value.", 484 ParamDescription: []string{""}, 485 }, 486 "tostring": { 487 Description: "`tostring` converts its argument to a string value.", 488 ParamDescription: []string{""}, 489 }, 490 "transpose": { 491 Description: "`transpose` takes a map of lists of strings and swaps the keys and values to produce a new map of lists of strings.", 492 ParamDescription: []string{""}, 493 }, 494 "trim": { 495 Description: "`trim` removes the specified set of characters from the start and end of the given string.", 496 ParamDescription: []string{ 497 "", 498 "A string containing all of the characters to trim. Each character is taken separately, so the order of characters is insignificant.", 499 }, 500 }, 501 "trimprefix": { 502 Description: "`trimprefix` removes the specified prefix from the start of the given string. If the string does not start with the prefix, the string is returned unchanged.", 503 ParamDescription: []string{"", ""}, 504 }, 505 "trimspace": { 506 Description: "`trimspace` removes any space characters from the start and end of the given string.", 507 ParamDescription: []string{""}, 508 }, 509 "trimsuffix": { 510 Description: "`trimsuffix` removes the specified suffix from the end of the given string.", 511 ParamDescription: []string{"", ""}, 512 }, 513 "try": { 514 Description: "`try` evaluates all of its argument expressions in turn and returns the result of the first one that does not produce any errors.", 515 ParamDescription: []string{""}, 516 }, 517 "type": { 518 Description: "`type` returns the type of a given value.", 519 ParamDescription: []string{""}, 520 }, 521 "upper": { 522 Description: "`upper` converts all cased letters in the given string to uppercase.", 523 ParamDescription: []string{""}, 524 }, 525 "urlencode": { 526 Description: "`urlencode` applies URL encoding to a given string.", 527 ParamDescription: []string{""}, 528 }, 529 "urldecode": { 530 Description: "`urldecode` applies URL decoding to a given encoded string.", 531 ParamDescription: []string{""}, 532 }, 533 "uuid": { 534 Description: "`uuid` generates a unique identifier string.", 535 ParamDescription: []string{}, 536 }, 537 "uuidv5": { 538 Description: "`uuidv5` generates a _name-based_ UUID, as described in [RFC 4122 section 4.3](https://tools.ietf.org/html/rfc4122#section-4.3), also known as a \"version 5\" UUID.", 539 ParamDescription: []string{"", ""}, 540 }, 541 "values": { 542 Description: "`values` takes a map and returns a list containing the values of the elements in that map.", 543 ParamDescription: []string{""}, 544 }, 545 "yamldecode": { 546 Description: "`yamldecode` parses a string as a subset of YAML, and produces a representation of its value.", 547 ParamDescription: []string{""}, 548 }, 549 "yamlencode": { 550 Description: "`yamlencode` encodes a given value to a string using [YAML 1.2](https://yaml.org/spec/1.2/spec.html) block syntax.", 551 ParamDescription: []string{""}, 552 }, 553 "zipmap": { 554 Description: "`zipmap` constructs a map from a list of keys and a corresponding list of values.", 555 ParamDescription: []string{"", ""}, 556 }, 557 } 558 559 // WithDescription looks up the description for a given function and uses 560 // go-cty's WithNewDescriptions to replace the function's description and 561 // parameter descriptions. 562 func WithDescription(name string, f function.Function) function.Function { 563 desc, ok := DescriptionList[name] 564 if !ok { 565 return f 566 } 567 568 // Will panic if ParamDescription doesn't match the number of parameters 569 // the function expects 570 return f.WithNewDescriptions(desc.Description, desc.ParamDescription) 571 }