tfts 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/src/cli/get.d.ts.map +1 -1
  2. package/dist/src/cli/get.js +34 -1
  3. package/dist/src/cli/get.js.map +1 -1
  4. package/dist/src/codegen/__tests__/fixtures.d.ts +5 -0
  5. package/dist/src/codegen/__tests__/fixtures.d.ts.map +1 -0
  6. package/dist/src/codegen/__tests__/fixtures.js +133 -0
  7. package/dist/src/codegen/__tests__/fixtures.js.map +1 -0
  8. package/dist/src/codegen/__tests__/generator.spec.js +233 -29
  9. package/dist/src/codegen/__tests__/generator.spec.js.map +1 -1
  10. package/dist/src/codegen/fn-generator.d.ts +22 -0
  11. package/dist/src/codegen/fn-generator.d.ts.map +1 -0
  12. package/dist/src/codegen/fn-generator.js +203 -0
  13. package/dist/src/codegen/fn-generator.js.map +1 -0
  14. package/dist/src/codegen/generator.d.ts +1 -5
  15. package/dist/src/codegen/generator.d.ts.map +1 -1
  16. package/dist/src/codegen/generator.js +368 -187
  17. package/dist/src/codegen/generator.js.map +1 -1
  18. package/dist/src/codegen/schema.d.ts +0 -2
  19. package/dist/src/codegen/schema.d.ts.map +1 -1
  20. package/dist/src/codegen/schema.js +0 -97
  21. package/dist/src/codegen/schema.js.map +1 -1
  22. package/dist/src/core/tokens.d.ts +8 -14
  23. package/dist/src/core/tokens.d.ts.map +1 -1
  24. package/dist/src/core/tokens.js +3 -3
  25. package/dist/src/core/tokens.js.map +1 -1
  26. package/dist/src/facade/datasource.d.ts +2 -2
  27. package/dist/src/facade/datasource.d.ts.map +1 -1
  28. package/dist/src/facade/datasource.js +2 -2
  29. package/dist/src/facade/datasource.js.map +1 -1
  30. package/dist/src/facade/resource.d.ts +2 -2
  31. package/dist/src/facade/resource.d.ts.map +1 -1
  32. package/dist/src/facade/resource.js +2 -2
  33. package/dist/src/facade/resource.js.map +1 -1
  34. package/dist/src/facade/stack.d.ts +1 -2
  35. package/dist/src/facade/stack.d.ts.map +1 -1
  36. package/dist/src/facade/stack.js +3 -1
  37. package/dist/src/facade/stack.js.map +1 -1
  38. package/dist/src/generated/fn.d.ts +599 -0
  39. package/dist/src/generated/fn.d.ts.map +1 -0
  40. package/dist/src/generated/fn.js +998 -0
  41. package/dist/src/generated/fn.js.map +1 -0
  42. package/dist/src/index.d.ts +5 -4
  43. package/dist/src/index.d.ts.map +1 -1
  44. package/dist/src/index.js +4 -3
  45. package/dist/src/index.js.map +1 -1
  46. package/package.json +3 -2
  47. package/dist/src/codegen/templates.d.ts +0 -13
  48. package/dist/src/codegen/templates.d.ts.map +0 -1
  49. package/dist/src/codegen/templates.js +0 -58
  50. package/dist/src/codegen/templates.js.map +0 -1
@@ -0,0 +1,998 @@
1
+ /**
2
+ * Generated by scripts/generate-fn.ts - do not edit manually.
3
+ * Regenerate: bun run generate:fn
4
+ */
5
+ import { fn, TokenValue } from "../core/tokens.js";
6
+ export class Fn {
7
+ /**
8
+ * `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.
9
+ * @see https://developer.hashicorp.com/terraform/language/functions/abs
10
+ */
11
+ static abs(num) {
12
+ const _num = num instanceof TokenValue ? num.toToken() : num;
13
+ return new TokenValue(fn("abs", _num));
14
+ }
15
+ /**
16
+ * `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.
17
+ * @see https://developer.hashicorp.com/terraform/language/functions/abspath
18
+ */
19
+ static abspath(path) {
20
+ const _path = path instanceof TokenValue ? path.toToken() : path;
21
+ return new TokenValue(fn("abspath", _path));
22
+ }
23
+ /**
24
+ * `alltrue` returns `true` if all elements in a given collection are `true` or `"true"`. It also returns `true` if the collection is empty.
25
+ * @see https://developer.hashicorp.com/terraform/language/functions/alltrue
26
+ */
27
+ static alltrue(list) {
28
+ const _list = list.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
29
+ return new TokenValue(fn("alltrue", _list));
30
+ }
31
+ /**
32
+ * `anytrue` returns `true` if any element in a given collection is `true` or `"true"`. It also returns `false` if the collection is empty.
33
+ * @see https://developer.hashicorp.com/terraform/language/functions/anytrue
34
+ */
35
+ static anytrue(list) {
36
+ const _list = list.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
37
+ return new TokenValue(fn("anytrue", _list));
38
+ }
39
+ /**
40
+ * `base64decode` takes a string containing a Base64 character sequence and returns the original string.
41
+ * @see https://developer.hashicorp.com/terraform/language/functions/base64decode
42
+ */
43
+ static base64decode(str) {
44
+ const _str = str instanceof TokenValue ? str.toToken() : str;
45
+ return new TokenValue(fn("base64decode", _str));
46
+ }
47
+ /**
48
+ * `base64encode` applies Base64 encoding to a string.
49
+ * @see https://developer.hashicorp.com/terraform/language/functions/base64encode
50
+ */
51
+ static base64encode(str) {
52
+ const _str = str instanceof TokenValue ? str.toToken() : str;
53
+ return new TokenValue(fn("base64encode", _str));
54
+ }
55
+ /**
56
+ * `base64gzip` compresses a string with gzip and then encodes the result in Base64 encoding.
57
+ * @see https://developer.hashicorp.com/terraform/language/functions/base64gzip
58
+ */
59
+ static base64gzip(str) {
60
+ const _str = str instanceof TokenValue ? str.toToken() : str;
61
+ return new TokenValue(fn("base64gzip", _str));
62
+ }
63
+ /**
64
+ * `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.
65
+ * @see https://developer.hashicorp.com/terraform/language/functions/base64sha256
66
+ */
67
+ static base64sha256(str) {
68
+ const _str = str instanceof TokenValue ? str.toToken() : str;
69
+ return new TokenValue(fn("base64sha256", _str));
70
+ }
71
+ /**
72
+ * `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.
73
+ * @see https://developer.hashicorp.com/terraform/language/functions/base64sha512
74
+ */
75
+ static base64sha512(str) {
76
+ const _str = str instanceof TokenValue ? str.toToken() : str;
77
+ return new TokenValue(fn("base64sha512", _str));
78
+ }
79
+ /**
80
+ * `basename` takes a string containing a filesystem path and removes all except the last portion from it.
81
+ * @see https://developer.hashicorp.com/terraform/language/functions/basename
82
+ */
83
+ static basename(path) {
84
+ const _path = path instanceof TokenValue ? path.toToken() : path;
85
+ return new TokenValue(fn("basename", _path));
86
+ }
87
+ /**
88
+ * `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.
89
+ * @see https://developer.hashicorp.com/terraform/language/functions/bcrypt
90
+ */
91
+ static bcrypt(str, ...cost) {
92
+ const _str = str instanceof TokenValue ? str.toToken() : str;
93
+ const _cost = cost.map(v => v instanceof TokenValue ? v.toToken() : v);
94
+ return new TokenValue(fn("bcrypt", _str, ..._cost));
95
+ }
96
+ /**
97
+ * `can` evaluates the given expression and returns a boolean value indicating whether the expression produced a result without any errors.
98
+ * @see https://developer.hashicorp.com/terraform/language/functions/can
99
+ */
100
+ static can(expression) {
101
+ const _expression = expression instanceof TokenValue ? expression.toToken() : expression;
102
+ return new TokenValue(fn("can", _expression));
103
+ }
104
+ /**
105
+ * `ceil` returns the closest whole number that is greater than or equal to the given value, which may be a fraction.
106
+ * @see https://developer.hashicorp.com/terraform/language/functions/ceil
107
+ */
108
+ static ceil(num) {
109
+ const _num = num instanceof TokenValue ? num.toToken() : num;
110
+ return new TokenValue(fn("ceil", _num));
111
+ }
112
+ /**
113
+ * `chomp` removes newline characters at the end of a string.
114
+ * @see https://developer.hashicorp.com/terraform/language/functions/chomp
115
+ */
116
+ static chomp(str) {
117
+ const _str = str instanceof TokenValue ? str.toToken() : str;
118
+ return new TokenValue(fn("chomp", _str));
119
+ }
120
+ /**
121
+ * `chunklist` splits a single list into fixed-size chunks, returning a list of lists.
122
+ * @see https://developer.hashicorp.com/terraform/language/functions/chunklist
123
+ */
124
+ static chunklist(list, size) {
125
+ const _list = list.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
126
+ const _size = size instanceof TokenValue ? size.toToken() : size;
127
+ return new TokenValue(fn("chunklist", _list, _size));
128
+ }
129
+ /**
130
+ * `cidrhost` calculates a full host IP address for a given host number within a given IP network address prefix.
131
+ * @see https://developer.hashicorp.com/terraform/language/functions/cidrhost
132
+ */
133
+ static cidrhost(prefix, hostnum) {
134
+ const _prefix = prefix instanceof TokenValue ? prefix.toToken() : prefix;
135
+ const _hostnum = hostnum instanceof TokenValue ? hostnum.toToken() : hostnum;
136
+ return new TokenValue(fn("cidrhost", _prefix, _hostnum));
137
+ }
138
+ /**
139
+ * `cidrnetmask` converts an IPv4 address prefix given in CIDR notation into a subnet mask address.
140
+ * @see https://developer.hashicorp.com/terraform/language/functions/cidrnetmask
141
+ */
142
+ static cidrnetmask(prefix) {
143
+ const _prefix = prefix instanceof TokenValue ? prefix.toToken() : prefix;
144
+ return new TokenValue(fn("cidrnetmask", _prefix));
145
+ }
146
+ /**
147
+ * `cidrsubnet` calculates a subnet address within given IP network address prefix.
148
+ * @see https://developer.hashicorp.com/terraform/language/functions/cidrsubnet
149
+ */
150
+ static cidrsubnet(prefix, newbits, netnum) {
151
+ const _prefix = prefix instanceof TokenValue ? prefix.toToken() : prefix;
152
+ const _newbits = newbits instanceof TokenValue ? newbits.toToken() : newbits;
153
+ const _netnum = netnum instanceof TokenValue ? netnum.toToken() : netnum;
154
+ return new TokenValue(fn("cidrsubnet", _prefix, _newbits, _netnum));
155
+ }
156
+ /**
157
+ * `cidrsubnets` calculates a sequence of consecutive IP address ranges within a particular CIDR prefix.
158
+ * @see https://developer.hashicorp.com/terraform/language/functions/cidrsubnets
159
+ */
160
+ static cidrsubnets(prefix, ...newbits) {
161
+ const _prefix = prefix instanceof TokenValue ? prefix.toToken() : prefix;
162
+ const _newbits = newbits.map(v => v instanceof TokenValue ? v.toToken() : v);
163
+ return new TokenValue(fn("cidrsubnets", _prefix, ..._newbits));
164
+ }
165
+ /**
166
+ * `coalesce` takes any number of arguments and returns the first one that isn't null or an empty string.
167
+ * @see https://developer.hashicorp.com/terraform/language/functions/coalesce
168
+ */
169
+ static coalesce(...vals) {
170
+ const _vals = vals.map(v => v instanceof TokenValue ? v.toToken() : v);
171
+ return new TokenValue(fn("coalesce", ..._vals));
172
+ }
173
+ /**
174
+ * `coalescelist` takes any number of list arguments and returns the first one that isn't empty.
175
+ * @see https://developer.hashicorp.com/terraform/language/functions/coalescelist
176
+ */
177
+ static coalescelist(...vals) {
178
+ const _vals = vals.map(v => v instanceof TokenValue ? v.toToken() : v);
179
+ return new TokenValue(fn("coalescelist", ..._vals));
180
+ }
181
+ /**
182
+ * `compact` takes a list of strings and returns a new list with any empty string elements removed.
183
+ * @see https://developer.hashicorp.com/terraform/language/functions/compact
184
+ */
185
+ static compact(list) {
186
+ const _list = list.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
187
+ return new TokenValue(fn("compact", _list));
188
+ }
189
+ /**
190
+ * `concat` takes two or more lists and combines them into a single list.
191
+ * @see https://developer.hashicorp.com/terraform/language/functions/concat
192
+ */
193
+ static concat(...seqs) {
194
+ const _seqs = seqs.map(v => v instanceof TokenValue ? v.toToken() : v);
195
+ return new TokenValue(fn("concat", ..._seqs));
196
+ }
197
+ /**
198
+ * `contains` determines whether a given list or set contains a given single value as one of its elements.
199
+ * @see https://developer.hashicorp.com/terraform/language/functions/contains
200
+ */
201
+ static contains(list, value) {
202
+ const _list = list instanceof TokenValue ? list.toToken() : list;
203
+ const _value = value instanceof TokenValue ? value.toToken() : value;
204
+ return new TokenValue(fn("contains", _list, _value));
205
+ }
206
+ /**
207
+ * `csvdecode` decodes a string containing CSV-formatted data and produces a list of maps representing that data.
208
+ * @see https://developer.hashicorp.com/terraform/language/functions/csvdecode
209
+ */
210
+ static csvdecode(str) {
211
+ const _str = str instanceof TokenValue ? str.toToken() : str;
212
+ return new TokenValue(fn("csvdecode", _str));
213
+ }
214
+ /**
215
+ * `dirname` takes a string containing a filesystem path and removes the last portion from it.
216
+ * @see https://developer.hashicorp.com/terraform/language/functions/dirname
217
+ */
218
+ static dirname(path) {
219
+ const _path = path instanceof TokenValue ? path.toToken() : path;
220
+ return new TokenValue(fn("dirname", _path));
221
+ }
222
+ /**
223
+ * `distinct` takes a list and returns a new list with any duplicate elements removed.
224
+ * @see https://developer.hashicorp.com/terraform/language/functions/distinct
225
+ */
226
+ static distinct(list) {
227
+ const _list = list.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
228
+ return new TokenValue(fn("distinct", _list));
229
+ }
230
+ /**
231
+ * `element` retrieves a single element from a list.
232
+ * @see https://developer.hashicorp.com/terraform/language/functions/element
233
+ */
234
+ static element(list, index) {
235
+ const _list = list instanceof TokenValue ? list.toToken() : list;
236
+ const _index = index instanceof TokenValue ? index.toToken() : index;
237
+ return new TokenValue(fn("element", _list, _index));
238
+ }
239
+ /**
240
+ * `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.
241
+ * @see https://developer.hashicorp.com/terraform/language/functions/endswith
242
+ */
243
+ static endswith(str, suffix) {
244
+ const _str = str instanceof TokenValue ? str.toToken() : str;
245
+ const _suffix = suffix instanceof TokenValue ? suffix.toToken() : suffix;
246
+ return new TokenValue(fn("endswith", _str, _suffix));
247
+ }
248
+ /**
249
+ * `ephemeralasnull` takes a value of any type and returns a similar value of the same type with any ephemeral values replaced with non-ephemeral null values and all non-ephemeral values preserved.
250
+ * @see https://developer.hashicorp.com/terraform/language/functions/ephemeralasnull
251
+ */
252
+ static ephemeralasnull(value) {
253
+ const _value = value instanceof TokenValue ? value.toToken() : value;
254
+ return new TokenValue(fn("ephemeralasnull", _value));
255
+ }
256
+ /**
257
+ * `file` reads the contents of a file at the given path and returns them as a string.
258
+ * @see https://developer.hashicorp.com/terraform/language/functions/file
259
+ */
260
+ static file(path) {
261
+ const _path = path instanceof TokenValue ? path.toToken() : path;
262
+ return new TokenValue(fn("file", _path));
263
+ }
264
+ /**
265
+ * `filebase64` reads the contents of a file at the given path and returns them as a base64-encoded string.
266
+ * @see https://developer.hashicorp.com/terraform/language/functions/filebase64
267
+ */
268
+ static filebase64(path) {
269
+ const _path = path instanceof TokenValue ? path.toToken() : path;
270
+ return new TokenValue(fn("filebase64", _path));
271
+ }
272
+ /**
273
+ * `filebase64sha256` is a variant of `base64sha256` that hashes the contents of a given file rather than a literal string.
274
+ * @see https://developer.hashicorp.com/terraform/language/functions/filebase64sha256
275
+ */
276
+ static filebase64sha256(path) {
277
+ const _path = path instanceof TokenValue ? path.toToken() : path;
278
+ return new TokenValue(fn("filebase64sha256", _path));
279
+ }
280
+ /**
281
+ * `filebase64sha512` is a variant of `base64sha512` that hashes the contents of a given file rather than a literal string.
282
+ * @see https://developer.hashicorp.com/terraform/language/functions/filebase64sha512
283
+ */
284
+ static filebase64sha512(path) {
285
+ const _path = path instanceof TokenValue ? path.toToken() : path;
286
+ return new TokenValue(fn("filebase64sha512", _path));
287
+ }
288
+ /**
289
+ * `fileexists` determines whether a file exists at a given path.
290
+ * @see https://developer.hashicorp.com/terraform/language/functions/fileexists
291
+ */
292
+ static fileexists(path) {
293
+ const _path = path instanceof TokenValue ? path.toToken() : path;
294
+ return new TokenValue(fn("fileexists", _path));
295
+ }
296
+ /**
297
+ * `filemd5` is a variant of `md5` that hashes the contents of a given file rather than a literal string.
298
+ * @see https://developer.hashicorp.com/terraform/language/functions/filemd5
299
+ */
300
+ static filemd5(path) {
301
+ const _path = path instanceof TokenValue ? path.toToken() : path;
302
+ return new TokenValue(fn("filemd5", _path));
303
+ }
304
+ /**
305
+ * `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.
306
+ * @see https://developer.hashicorp.com/terraform/language/functions/fileset
307
+ */
308
+ static fileset(path, pattern) {
309
+ const _path = path instanceof TokenValue ? path.toToken() : path;
310
+ const _pattern = pattern instanceof TokenValue ? pattern.toToken() : pattern;
311
+ return new TokenValue(fn("fileset", _path, _pattern));
312
+ }
313
+ /**
314
+ * `filesha1` is a variant of `sha1` that hashes the contents of a given file rather than a literal string.
315
+ * @see https://developer.hashicorp.com/terraform/language/functions/filesha1
316
+ */
317
+ static filesha1(path) {
318
+ const _path = path instanceof TokenValue ? path.toToken() : path;
319
+ return new TokenValue(fn("filesha1", _path));
320
+ }
321
+ /**
322
+ * `filesha256` is a variant of `sha256` that hashes the contents of a given file rather than a literal string.
323
+ * @see https://developer.hashicorp.com/terraform/language/functions/filesha256
324
+ */
325
+ static filesha256(path) {
326
+ const _path = path instanceof TokenValue ? path.toToken() : path;
327
+ return new TokenValue(fn("filesha256", _path));
328
+ }
329
+ /**
330
+ * `filesha512` is a variant of `sha512` that hashes the contents of a given file rather than a literal string.
331
+ * @see https://developer.hashicorp.com/terraform/language/functions/filesha512
332
+ */
333
+ static filesha512(path) {
334
+ const _path = path instanceof TokenValue ? path.toToken() : path;
335
+ return new TokenValue(fn("filesha512", _path));
336
+ }
337
+ /**
338
+ * `flatten` takes a list and replaces any elements that are lists with a flattened sequence of the list contents.
339
+ * @see https://developer.hashicorp.com/terraform/language/functions/flatten
340
+ */
341
+ static flatten(list) {
342
+ const _list = list instanceof TokenValue ? list.toToken() : list;
343
+ return new TokenValue(fn("flatten", _list));
344
+ }
345
+ /**
346
+ * `floor` returns the closest whole number that is less than or equal to the given value, which may be a fraction.
347
+ * @see https://developer.hashicorp.com/terraform/language/functions/floor
348
+ */
349
+ static floor(num) {
350
+ const _num = num instanceof TokenValue ? num.toToken() : num;
351
+ return new TokenValue(fn("floor", _num));
352
+ }
353
+ /**
354
+ * 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.
355
+ * @see https://developer.hashicorp.com/terraform/language/functions/format
356
+ */
357
+ static format(format, ...args) {
358
+ const _format = format instanceof TokenValue ? format.toToken() : format;
359
+ const _args = args.map(v => v instanceof TokenValue ? v.toToken() : v);
360
+ return new TokenValue(fn("format", _format, ..._args));
361
+ }
362
+ /**
363
+ * `formatdate` converts a timestamp into a different time format.
364
+ * @see https://developer.hashicorp.com/terraform/language/functions/formatdate
365
+ */
366
+ static formatdate(format, time) {
367
+ const _format = format instanceof TokenValue ? format.toToken() : format;
368
+ const _time = time instanceof TokenValue ? time.toToken() : time;
369
+ return new TokenValue(fn("formatdate", _format, _time));
370
+ }
371
+ /**
372
+ * `formatlist` produces a list of strings by formatting a number of other values according to a specification string.
373
+ * @see https://developer.hashicorp.com/terraform/language/functions/formatlist
374
+ */
375
+ static formatlist(format, ...args) {
376
+ const _format = format instanceof TokenValue ? format.toToken() : format;
377
+ const _args = args.map(v => v instanceof TokenValue ? v.toToken() : v);
378
+ return new TokenValue(fn("formatlist", _format, ..._args));
379
+ }
380
+ /**
381
+ * `indent` adds a given number of spaces to the beginnings of all but the first line in a given multi-line string.
382
+ * @see https://developer.hashicorp.com/terraform/language/functions/indent
383
+ */
384
+ static indent(spaces, str) {
385
+ const _spaces = spaces instanceof TokenValue ? spaces.toToken() : spaces;
386
+ const _str = str instanceof TokenValue ? str.toToken() : str;
387
+ return new TokenValue(fn("indent", _spaces, _str));
388
+ }
389
+ /**
390
+ * `index` finds the element index for a given value in a list.
391
+ * @see https://developer.hashicorp.com/terraform/language/functions/index
392
+ */
393
+ static index(list, value) {
394
+ const _list = list instanceof TokenValue ? list.toToken() : list;
395
+ const _value = value instanceof TokenValue ? value.toToken() : value;
396
+ return new TokenValue(fn("index", _list, _value));
397
+ }
398
+ /**
399
+ * `issensitive` takes a value and returns a boolean indicating if the value is sensitive.
400
+ * @see https://developer.hashicorp.com/terraform/language/functions/issensitive
401
+ */
402
+ static issensitive(value) {
403
+ const _value = value instanceof TokenValue ? value.toToken() : value;
404
+ return new TokenValue(fn("issensitive", _value));
405
+ }
406
+ /**
407
+ * `join` produces a string by concatenating together all elements of a given list of strings with the given delimiter.
408
+ * @see https://developer.hashicorp.com/terraform/language/functions/join
409
+ */
410
+ static join(separator, ...lists) {
411
+ const _separator = separator instanceof TokenValue ? separator.toToken() : separator;
412
+ const _lists = lists.map(v => v.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0));
413
+ return new TokenValue(fn("join", _separator, ..._lists));
414
+ }
415
+ /**
416
+ * `jsondecode` interprets a given string as JSON, returning a representation of the result of decoding that string.
417
+ * @see https://developer.hashicorp.com/terraform/language/functions/jsondecode
418
+ */
419
+ static jsondecode(str) {
420
+ const _str = str instanceof TokenValue ? str.toToken() : str;
421
+ return new TokenValue(fn("jsondecode", _str));
422
+ }
423
+ /**
424
+ * `jsonencode` encodes a given value to a string using JSON syntax.
425
+ * @see https://developer.hashicorp.com/terraform/language/functions/jsonencode
426
+ */
427
+ static jsonencode(val) {
428
+ const _val = val instanceof TokenValue ? val.toToken() : val;
429
+ return new TokenValue(fn("jsonencode", _val));
430
+ }
431
+ /**
432
+ * `keys` takes a map and returns a list containing the keys from that map.
433
+ * @see https://developer.hashicorp.com/terraform/language/functions/keys
434
+ */
435
+ static keys(inputMap) {
436
+ const _inputMap = inputMap instanceof TokenValue ? inputMap.toToken() : inputMap;
437
+ return new TokenValue(fn("keys", _inputMap));
438
+ }
439
+ /**
440
+ * `length` determines the length of a given list, map, or string.
441
+ * @see https://developer.hashicorp.com/terraform/language/functions/length
442
+ */
443
+ static length(value) {
444
+ const _value = value instanceof TokenValue ? value.toToken() : value;
445
+ return new TokenValue(fn("length", _value));
446
+ }
447
+ /**
448
+ * `log` returns the logarithm of a given number in a given base.
449
+ * @see https://developer.hashicorp.com/terraform/language/functions/log
450
+ */
451
+ static log(num, base) {
452
+ const _num = num instanceof TokenValue ? num.toToken() : num;
453
+ const _base = base instanceof TokenValue ? base.toToken() : base;
454
+ return new TokenValue(fn("log", _num, _base));
455
+ }
456
+ /**
457
+ * `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.
458
+ * @see https://developer.hashicorp.com/terraform/language/functions/lookup
459
+ */
460
+ static lookup(inputMap, key, ...default_) {
461
+ const _inputMap = inputMap instanceof TokenValue ? inputMap.toToken() : inputMap;
462
+ const _key = key instanceof TokenValue ? key.toToken() : key;
463
+ const _default_ = default_.map(v => v instanceof TokenValue ? v.toToken() : v);
464
+ return new TokenValue(fn("lookup", _inputMap, _key, ..._default_));
465
+ }
466
+ /**
467
+ * `lower` converts all cased letters in the given string to lowercase.
468
+ * @see https://developer.hashicorp.com/terraform/language/functions/lower
469
+ */
470
+ static lower(str) {
471
+ const _str = str instanceof TokenValue ? str.toToken() : str;
472
+ return new TokenValue(fn("lower", _str));
473
+ }
474
+ /**
475
+ * `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.
476
+ * @see https://developer.hashicorp.com/terraform/language/functions/matchkeys
477
+ */
478
+ static matchkeys(values, keys, searchset) {
479
+ const _values = values.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
480
+ const _keys = keys.map(v1 => v1 instanceof TokenValue ? v1.toToken() : v1);
481
+ const _searchset = searchset.map(v2 => v2 instanceof TokenValue ? v2.toToken() : v2);
482
+ return new TokenValue(fn("matchkeys", _values, _keys, _searchset));
483
+ }
484
+ /**
485
+ * `max` takes one or more numbers and returns the greatest number from the set.
486
+ * @see https://developer.hashicorp.com/terraform/language/functions/max
487
+ */
488
+ static max(...numbers) {
489
+ const _numbers = numbers.map(v => v instanceof TokenValue ? v.toToken() : v);
490
+ return new TokenValue(fn("max", ..._numbers));
491
+ }
492
+ /**
493
+ * `md5` computes the MD5 hash of a given string and encodes it with hexadecimal digits.
494
+ * @see https://developer.hashicorp.com/terraform/language/functions/md5
495
+ */
496
+ static md5(str) {
497
+ const _str = str instanceof TokenValue ? str.toToken() : str;
498
+ return new TokenValue(fn("md5", _str));
499
+ }
500
+ /**
501
+ * `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.
502
+ * @see https://developer.hashicorp.com/terraform/language/functions/merge
503
+ */
504
+ static merge(...maps) {
505
+ const _maps = maps.map(v => v instanceof TokenValue ? v.toToken() : v);
506
+ return new TokenValue(fn("merge", ..._maps));
507
+ }
508
+ /**
509
+ * `min` takes one or more numbers and returns the smallest number from the set.
510
+ * @see https://developer.hashicorp.com/terraform/language/functions/min
511
+ */
512
+ static min(...numbers) {
513
+ const _numbers = numbers.map(v => v instanceof TokenValue ? v.toToken() : v);
514
+ return new TokenValue(fn("min", ..._numbers));
515
+ }
516
+ /**
517
+ * `nonsensitive` takes a sensitive value and returns a copy of that value with the sensitive marking removed, thereby exposing the sensitive value.
518
+ * @see https://developer.hashicorp.com/terraform/language/functions/nonsensitive
519
+ */
520
+ static nonsensitive(value) {
521
+ const _value = value instanceof TokenValue ? value.toToken() : value;
522
+ return new TokenValue(fn("nonsensitive", _value));
523
+ }
524
+ /**
525
+ * `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.
526
+ * @see https://developer.hashicorp.com/terraform/language/functions/one
527
+ */
528
+ static one(list) {
529
+ const _list = list instanceof TokenValue ? list.toToken() : list;
530
+ return new TokenValue(fn("one", _list));
531
+ }
532
+ /**
533
+ * `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.
534
+ * @see https://developer.hashicorp.com/terraform/language/functions/parseint
535
+ */
536
+ static parseint(number, base) {
537
+ const _number = number instanceof TokenValue ? number.toToken() : number;
538
+ const _base = base instanceof TokenValue ? base.toToken() : base;
539
+ return new TokenValue(fn("parseint", _number, _base));
540
+ }
541
+ /**
542
+ * `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.
543
+ * @see https://developer.hashicorp.com/terraform/language/functions/pathexpand
544
+ */
545
+ static pathexpand(path) {
546
+ const _path = path instanceof TokenValue ? path.toToken() : path;
547
+ return new TokenValue(fn("pathexpand", _path));
548
+ }
549
+ /**
550
+ * `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.
551
+ * @see https://developer.hashicorp.com/terraform/language/functions/plantimestamp
552
+ */
553
+ static plantimestamp() {
554
+ return new TokenValue(fn("plantimestamp"));
555
+ }
556
+ /**
557
+ * `pow` calculates an exponent, by raising its first argument to the power of the second argument.
558
+ * @see https://developer.hashicorp.com/terraform/language/functions/pow
559
+ */
560
+ static pow(num, power) {
561
+ const _num = num instanceof TokenValue ? num.toToken() : num;
562
+ const _power = power instanceof TokenValue ? power.toToken() : power;
563
+ return new TokenValue(fn("pow", _num, _power));
564
+ }
565
+ /**
566
+ * `range` generates a list of numbers using a start value, a limit value, and a step value.
567
+ * @see https://developer.hashicorp.com/terraform/language/functions/range
568
+ */
569
+ static range(...params) {
570
+ const _params = params.map(v => v instanceof TokenValue ? v.toToken() : v);
571
+ return new TokenValue(fn("range", ..._params));
572
+ }
573
+ /**
574
+ * `regex` applies a [regular expression](https://en.wikipedia.org/wiki/Regular_expression) to a string and returns the matching substrings.
575
+ * @see https://developer.hashicorp.com/terraform/language/functions/regex
576
+ */
577
+ static regex(pattern, string) {
578
+ const _pattern = pattern instanceof TokenValue ? pattern.toToken() : pattern;
579
+ const _string = string instanceof TokenValue ? string.toToken() : string;
580
+ return new TokenValue(fn("regex", _pattern, _string));
581
+ }
582
+ /**
583
+ * `regexall` applies a [regular expression](https://en.wikipedia.org/wiki/Regular_expression) to a string and returns a list of all matches.
584
+ * @see https://developer.hashicorp.com/terraform/language/functions/regexall
585
+ */
586
+ static regexall(pattern, string) {
587
+ const _pattern = pattern instanceof TokenValue ? pattern.toToken() : pattern;
588
+ const _string = string instanceof TokenValue ? string.toToken() : string;
589
+ return new TokenValue(fn("regexall", _pattern, _string));
590
+ }
591
+ /**
592
+ * `replace` searches a given string for another given substring, and replaces each occurrence with a given replacement string.
593
+ * @see https://developer.hashicorp.com/terraform/language/functions/replace
594
+ */
595
+ static replace(str, substr, replace) {
596
+ const _str = str instanceof TokenValue ? str.toToken() : str;
597
+ const _substr = substr instanceof TokenValue ? substr.toToken() : substr;
598
+ const _replace = replace instanceof TokenValue ? replace.toToken() : replace;
599
+ return new TokenValue(fn("replace", _str, _substr, _replace));
600
+ }
601
+ /**
602
+ * `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.
603
+ * @see https://developer.hashicorp.com/terraform/language/functions/reverse
604
+ */
605
+ static reverse(list) {
606
+ const _list = list instanceof TokenValue ? list.toToken() : list;
607
+ return new TokenValue(fn("reverse", _list));
608
+ }
609
+ /**
610
+ * `rsadecrypt` decrypts an RSA-encrypted ciphertext, returning the corresponding cleartext.
611
+ * @see https://developer.hashicorp.com/terraform/language/functions/rsadecrypt
612
+ */
613
+ static rsadecrypt(ciphertext, privatekey) {
614
+ const _ciphertext = ciphertext instanceof TokenValue ? ciphertext.toToken() : ciphertext;
615
+ const _privatekey = privatekey instanceof TokenValue ? privatekey.toToken() : privatekey;
616
+ return new TokenValue(fn("rsadecrypt", _ciphertext, _privatekey));
617
+ }
618
+ /**
619
+ * `sensitive` takes any value and returns a copy of it marked so that Terraform will treat it as sensitive, with the same meaning and behavior as for [sensitive input variables](/terraform/language/values/variables#suppressing-values-in-cli-output).
620
+ * @see https://developer.hashicorp.com/terraform/language/functions/sensitive
621
+ */
622
+ static sensitive(value) {
623
+ const _value = value instanceof TokenValue ? value.toToken() : value;
624
+ return new TokenValue(fn("sensitive", _value));
625
+ }
626
+ /**
627
+ * 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.
628
+ * @see https://developer.hashicorp.com/terraform/language/functions/setintersection
629
+ */
630
+ static setintersection(first_set, ...other_sets) {
631
+ const _first_set = first_set.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
632
+ const _other_sets = other_sets.map(v => v.map(v1 => v1 instanceof TokenValue ? v1.toToken() : v1));
633
+ return new TokenValue(fn("setintersection", _first_set, ..._other_sets));
634
+ }
635
+ /**
636
+ * 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).
637
+ * @see https://developer.hashicorp.com/terraform/language/functions/setproduct
638
+ */
639
+ static setproduct(...sets) {
640
+ const _sets = sets.map(v => v instanceof TokenValue ? v.toToken() : v);
641
+ return new TokenValue(fn("setproduct", ..._sets));
642
+ }
643
+ /**
644
+ * 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.
645
+ * @see https://developer.hashicorp.com/terraform/language/functions/setsubtract
646
+ */
647
+ static setsubtract(a, b) {
648
+ const _a = a.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
649
+ const _b = b.map(v1 => v1 instanceof TokenValue ? v1.toToken() : v1);
650
+ return new TokenValue(fn("setsubtract", _a, _b));
651
+ }
652
+ /**
653
+ * 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.
654
+ * @see https://developer.hashicorp.com/terraform/language/functions/setunion
655
+ */
656
+ static setunion(first_set, ...other_sets) {
657
+ const _first_set = first_set.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
658
+ const _other_sets = other_sets.map(v => v.map(v1 => v1 instanceof TokenValue ? v1.toToken() : v1));
659
+ return new TokenValue(fn("setunion", _first_set, ..._other_sets));
660
+ }
661
+ /**
662
+ * `sha1` computes the SHA1 hash of a given string and encodes it with hexadecimal digits.
663
+ * @see https://developer.hashicorp.com/terraform/language/functions/sha1
664
+ */
665
+ static sha1(str) {
666
+ const _str = str instanceof TokenValue ? str.toToken() : str;
667
+ return new TokenValue(fn("sha1", _str));
668
+ }
669
+ /**
670
+ * `sha256` computes the SHA256 hash of a given string and encodes it with hexadecimal digits.
671
+ * @see https://developer.hashicorp.com/terraform/language/functions/sha256
672
+ */
673
+ static sha256(str) {
674
+ const _str = str instanceof TokenValue ? str.toToken() : str;
675
+ return new TokenValue(fn("sha256", _str));
676
+ }
677
+ /**
678
+ * `sha512` computes the SHA512 hash of a given string and encodes it with hexadecimal digits.
679
+ * @see https://developer.hashicorp.com/terraform/language/functions/sha512
680
+ */
681
+ static sha512(str) {
682
+ const _str = str instanceof TokenValue ? str.toToken() : str;
683
+ return new TokenValue(fn("sha512", _str));
684
+ }
685
+ /**
686
+ * `signum` determines the sign of a number, returning a number between -1 and 1 to represent the sign.
687
+ * @see https://developer.hashicorp.com/terraform/language/functions/signum
688
+ */
689
+ static signum(num) {
690
+ const _num = num instanceof TokenValue ? num.toToken() : num;
691
+ return new TokenValue(fn("signum", _num));
692
+ }
693
+ /**
694
+ * `slice` extracts some consecutive elements from within a list.
695
+ * @see https://developer.hashicorp.com/terraform/language/functions/slice
696
+ */
697
+ static slice(list, start_index, end_index) {
698
+ const _list = list instanceof TokenValue ? list.toToken() : list;
699
+ const _start_index = start_index instanceof TokenValue ? start_index.toToken() : start_index;
700
+ const _end_index = end_index instanceof TokenValue ? end_index.toToken() : end_index;
701
+ return new TokenValue(fn("slice", _list, _start_index, _end_index));
702
+ }
703
+ /**
704
+ * `sort` takes a list of strings and returns a new list with those strings sorted lexicographically.
705
+ * @see https://developer.hashicorp.com/terraform/language/functions/sort
706
+ */
707
+ static sort(list) {
708
+ const _list = list.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
709
+ return new TokenValue(fn("sort", _list));
710
+ }
711
+ /**
712
+ * `split` produces a list by dividing a given string at all occurrences of a given separator.
713
+ * @see https://developer.hashicorp.com/terraform/language/functions/split
714
+ */
715
+ static split(separator, str) {
716
+ const _separator = separator instanceof TokenValue ? separator.toToken() : separator;
717
+ const _str = str instanceof TokenValue ? str.toToken() : str;
718
+ return new TokenValue(fn("split", _separator, _str));
719
+ }
720
+ /**
721
+ * `startswith` takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix.
722
+ * @see https://developer.hashicorp.com/terraform/language/functions/startswith
723
+ */
724
+ static startswith(str, prefix) {
725
+ const _str = str instanceof TokenValue ? str.toToken() : str;
726
+ const _prefix = prefix instanceof TokenValue ? prefix.toToken() : prefix;
727
+ return new TokenValue(fn("startswith", _str, _prefix));
728
+ }
729
+ /**
730
+ * `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.
731
+ * @see https://developer.hashicorp.com/terraform/language/functions/strcontains
732
+ */
733
+ static strcontains(str, substr) {
734
+ const _str = str instanceof TokenValue ? str.toToken() : str;
735
+ const _substr = substr instanceof TokenValue ? substr.toToken() : substr;
736
+ return new TokenValue(fn("strcontains", _str, _substr));
737
+ }
738
+ /**
739
+ * `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).
740
+ * @see https://developer.hashicorp.com/terraform/language/functions/strrev
741
+ */
742
+ static strrev(str) {
743
+ const _str = str instanceof TokenValue ? str.toToken() : str;
744
+ return new TokenValue(fn("strrev", _str));
745
+ }
746
+ /**
747
+ * `substr` extracts a substring from a given string by offset and (maximum) length.
748
+ * @see https://developer.hashicorp.com/terraform/language/functions/substr
749
+ */
750
+ static substr(str, offset, length) {
751
+ const _str = str instanceof TokenValue ? str.toToken() : str;
752
+ const _offset = offset instanceof TokenValue ? offset.toToken() : offset;
753
+ const _length = length instanceof TokenValue ? length.toToken() : length;
754
+ return new TokenValue(fn("substr", _str, _offset, _length));
755
+ }
756
+ /**
757
+ * `sum` takes a list or set of numbers and returns the sum of those numbers.
758
+ * @see https://developer.hashicorp.com/terraform/language/functions/sum
759
+ */
760
+ static sum(list) {
761
+ const _list = list instanceof TokenValue ? list.toToken() : list;
762
+ return new TokenValue(fn("sum", _list));
763
+ }
764
+ /**
765
+ * `templatefile` reads the file at the given path and renders its content as a template using a supplied set of template variables.
766
+ * @see https://developer.hashicorp.com/terraform/language/functions/templatefile
767
+ */
768
+ static templatefile(path, vars) {
769
+ const _path = path instanceof TokenValue ? path.toToken() : path;
770
+ const _vars = vars instanceof TokenValue ? vars.toToken() : vars;
771
+ return new TokenValue(fn("templatefile", _path, _vars));
772
+ }
773
+ /**
774
+ * `templatestring` takes a string from elsewhere in the module and renders its content as a template using a supplied set of template variables.
775
+ * @see https://developer.hashicorp.com/terraform/language/functions/templatestring
776
+ */
777
+ static templatestring(template, vars) {
778
+ const _template = template instanceof TokenValue ? template.toToken() : template;
779
+ const _vars = vars instanceof TokenValue ? vars.toToken() : vars;
780
+ return new TokenValue(fn("templatestring", _template, _vars));
781
+ }
782
+ /**
783
+ * `textdecodebase64` function decodes a string that was previously Base64-encoded, and then interprets the result as characters in a specified character encoding.
784
+ * @see https://developer.hashicorp.com/terraform/language/functions/textdecodebase64
785
+ */
786
+ static textdecodebase64(source, encoding) {
787
+ const _source = source instanceof TokenValue ? source.toToken() : source;
788
+ const _encoding = encoding instanceof TokenValue ? encoding.toToken() : encoding;
789
+ return new TokenValue(fn("textdecodebase64", _source, _encoding));
790
+ }
791
+ /**
792
+ * `textencodebase64` encodes the unicode characters in a given string using a specified character encoding, returning the result base64 encoded because Terraform language strings are always sequences of unicode characters.
793
+ * @see https://developer.hashicorp.com/terraform/language/functions/textencodebase64
794
+ */
795
+ static textencodebase64(string, encoding) {
796
+ const _string = string instanceof TokenValue ? string.toToken() : string;
797
+ const _encoding = encoding instanceof TokenValue ? encoding.toToken() : encoding;
798
+ return new TokenValue(fn("textencodebase64", _string, _encoding));
799
+ }
800
+ /**
801
+ * `timeadd` adds a duration to a timestamp, returning a new timestamp.
802
+ * @see https://developer.hashicorp.com/terraform/language/functions/timeadd
803
+ */
804
+ static timeadd(timestamp, duration) {
805
+ const _timestamp = timestamp instanceof TokenValue ? timestamp.toToken() : timestamp;
806
+ const _duration = duration instanceof TokenValue ? duration.toToken() : duration;
807
+ return new TokenValue(fn("timeadd", _timestamp, _duration));
808
+ }
809
+ /**
810
+ * `timecmp` compares two timestamps and returns a number that represents the ordering of the instants those timestamps represent.
811
+ * @see https://developer.hashicorp.com/terraform/language/functions/timecmp
812
+ */
813
+ static timecmp(timestamp_a, timestamp_b) {
814
+ const _timestamp_a = timestamp_a instanceof TokenValue ? timestamp_a.toToken() : timestamp_a;
815
+ const _timestamp_b = timestamp_b instanceof TokenValue ? timestamp_b.toToken() : timestamp_b;
816
+ return new TokenValue(fn("timecmp", _timestamp_a, _timestamp_b));
817
+ }
818
+ /**
819
+ * `timestamp` returns a UTC timestamp string in [RFC 3339](https://tools.ietf.org/html/rfc3339) format.
820
+ * @see https://developer.hashicorp.com/terraform/language/functions/timestamp
821
+ */
822
+ static timestamp() {
823
+ return new TokenValue(fn("timestamp"));
824
+ }
825
+ /**
826
+ * `title` converts the first letter of each word in the given string to uppercase.
827
+ * @see https://developer.hashicorp.com/terraform/language/functions/title
828
+ */
829
+ static title(str) {
830
+ const _str = str instanceof TokenValue ? str.toToken() : str;
831
+ return new TokenValue(fn("title", _str));
832
+ }
833
+ /**
834
+ * `tobool` converts its argument to a boolean value.
835
+ * @see https://developer.hashicorp.com/terraform/language/functions/tobool
836
+ */
837
+ static tobool(v) {
838
+ const _v = v instanceof TokenValue ? v.toToken() : v;
839
+ return new TokenValue(fn("tobool", _v));
840
+ }
841
+ /**
842
+ * `tolist` converts its argument to a list value.
843
+ * @see https://developer.hashicorp.com/terraform/language/functions/tolist
844
+ */
845
+ static tolist(v) {
846
+ const _v = v instanceof TokenValue ? v.toToken() : v;
847
+ return new TokenValue(fn("tolist", _v));
848
+ }
849
+ /**
850
+ * `tomap` converts its argument to a map value.
851
+ * @see https://developer.hashicorp.com/terraform/language/functions/tomap
852
+ */
853
+ static tomap(v) {
854
+ const _v = v instanceof TokenValue ? v.toToken() : v;
855
+ return new TokenValue(fn("tomap", _v));
856
+ }
857
+ /**
858
+ * `tonumber` converts its argument to a number value.
859
+ * @see https://developer.hashicorp.com/terraform/language/functions/tonumber
860
+ */
861
+ static tonumber(v) {
862
+ const _v = v instanceof TokenValue ? v.toToken() : v;
863
+ return new TokenValue(fn("tonumber", _v));
864
+ }
865
+ /**
866
+ * `toset` converts its argument to a set value.
867
+ * @see https://developer.hashicorp.com/terraform/language/functions/toset
868
+ */
869
+ static toset(v) {
870
+ const _v = v instanceof TokenValue ? v.toToken() : v;
871
+ return new TokenValue(fn("toset", _v));
872
+ }
873
+ /**
874
+ * `tostring` converts its argument to a string value.
875
+ * @see https://developer.hashicorp.com/terraform/language/functions/tostring
876
+ */
877
+ static tostring(v) {
878
+ const _v = v instanceof TokenValue ? v.toToken() : v;
879
+ return new TokenValue(fn("tostring", _v));
880
+ }
881
+ /**
882
+ * `transpose` takes a map of lists of strings and swaps the keys and values to produce a new map of lists of strings.
883
+ * @see https://developer.hashicorp.com/terraform/language/functions/transpose
884
+ */
885
+ static transpose(values) {
886
+ const _values = Object.fromEntries(Object.entries(values).map(([k0, v0]) => [k0, v0.map(v1 => v1 instanceof TokenValue ? v1.toToken() : v1)]));
887
+ return new TokenValue(fn("transpose", _values));
888
+ }
889
+ /**
890
+ * `trim` removes the specified set of characters from the start and end of the given string.
891
+ * @see https://developer.hashicorp.com/terraform/language/functions/trim
892
+ */
893
+ static trim(str, cutset) {
894
+ const _str = str instanceof TokenValue ? str.toToken() : str;
895
+ const _cutset = cutset instanceof TokenValue ? cutset.toToken() : cutset;
896
+ return new TokenValue(fn("trim", _str, _cutset));
897
+ }
898
+ /**
899
+ * `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.
900
+ * @see https://developer.hashicorp.com/terraform/language/functions/trimprefix
901
+ */
902
+ static trimprefix(str, prefix) {
903
+ const _str = str instanceof TokenValue ? str.toToken() : str;
904
+ const _prefix = prefix instanceof TokenValue ? prefix.toToken() : prefix;
905
+ return new TokenValue(fn("trimprefix", _str, _prefix));
906
+ }
907
+ /**
908
+ * `trimspace` removes any space characters from the start and end of the given string.
909
+ * @see https://developer.hashicorp.com/terraform/language/functions/trimspace
910
+ */
911
+ static trimspace(str) {
912
+ const _str = str instanceof TokenValue ? str.toToken() : str;
913
+ return new TokenValue(fn("trimspace", _str));
914
+ }
915
+ /**
916
+ * `trimsuffix` removes the specified suffix from the end of the given string.
917
+ * @see https://developer.hashicorp.com/terraform/language/functions/trimsuffix
918
+ */
919
+ static trimsuffix(str, suffix) {
920
+ const _str = str instanceof TokenValue ? str.toToken() : str;
921
+ const _suffix = suffix instanceof TokenValue ? suffix.toToken() : suffix;
922
+ return new TokenValue(fn("trimsuffix", _str, _suffix));
923
+ }
924
+ /**
925
+ * `try` evaluates all of its argument expressions in turn and returns the result of the first one that does not produce any errors.
926
+ * @see https://developer.hashicorp.com/terraform/language/functions/try
927
+ */
928
+ static try(...expressions) {
929
+ const _expressions = expressions.map(v => v instanceof TokenValue ? v.toToken() : v);
930
+ return new TokenValue(fn("try", ..._expressions));
931
+ }
932
+ /**
933
+ * `upper` converts all cased letters in the given string to uppercase.
934
+ * @see https://developer.hashicorp.com/terraform/language/functions/upper
935
+ */
936
+ static upper(str) {
937
+ const _str = str instanceof TokenValue ? str.toToken() : str;
938
+ return new TokenValue(fn("upper", _str));
939
+ }
940
+ /**
941
+ * `urlencode` applies URL encoding to a given string.
942
+ * @see https://developer.hashicorp.com/terraform/language/functions/urlencode
943
+ */
944
+ static urlencode(str) {
945
+ const _str = str instanceof TokenValue ? str.toToken() : str;
946
+ return new TokenValue(fn("urlencode", _str));
947
+ }
948
+ /**
949
+ * `uuid` generates a unique identifier string.
950
+ * @see https://developer.hashicorp.com/terraform/language/functions/uuid
951
+ */
952
+ static uuid() {
953
+ return new TokenValue(fn("uuid"));
954
+ }
955
+ /**
956
+ * `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.
957
+ * @see https://developer.hashicorp.com/terraform/language/functions/uuidv5
958
+ */
959
+ static uuidv5(namespace, name) {
960
+ const _namespace = namespace instanceof TokenValue ? namespace.toToken() : namespace;
961
+ const _name = name instanceof TokenValue ? name.toToken() : name;
962
+ return new TokenValue(fn("uuidv5", _namespace, _name));
963
+ }
964
+ /**
965
+ * `values` takes a map and returns a list containing the values of the elements in that map.
966
+ * @see https://developer.hashicorp.com/terraform/language/functions/values
967
+ */
968
+ static values(mapping) {
969
+ const _mapping = mapping instanceof TokenValue ? mapping.toToken() : mapping;
970
+ return new TokenValue(fn("values", _mapping));
971
+ }
972
+ /**
973
+ * `yamldecode` parses a string as a subset of YAML, and produces a representation of its value.
974
+ * @see https://developer.hashicorp.com/terraform/language/functions/yamldecode
975
+ */
976
+ static yamldecode(src) {
977
+ const _src = src instanceof TokenValue ? src.toToken() : src;
978
+ return new TokenValue(fn("yamldecode", _src));
979
+ }
980
+ /**
981
+ * `yamlencode` encodes a given value to a string using [YAML 1.2](https://yaml.org/spec/1.2/spec.html) block syntax.
982
+ * @see https://developer.hashicorp.com/terraform/language/functions/yamlencode
983
+ */
984
+ static yamlencode(value) {
985
+ const _value = value instanceof TokenValue ? value.toToken() : value;
986
+ return new TokenValue(fn("yamlencode", _value));
987
+ }
988
+ /**
989
+ * `zipmap` constructs a map from a list of keys and a corresponding list of values.
990
+ * @see https://developer.hashicorp.com/terraform/language/functions/zipmap
991
+ */
992
+ static zipmap(keys, values) {
993
+ const _keys = keys.map(v0 => v0 instanceof TokenValue ? v0.toToken() : v0);
994
+ const _values = values instanceof TokenValue ? values.toToken() : values;
995
+ return new TokenValue(fn("zipmap", _keys, _values));
996
+ }
997
+ }
998
+ //# sourceMappingURL=fn.js.map