Skip to main content

Initializers

import { Fn } from 'cdktn'

new Fn()
NameTypeDescription

Static Functions

NameDescription
absabs 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.
abspathabspath 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.
alltruealltrue returns true if all elements in a given collection are true or "true". It also returns true if the collection is empty.
anytrueanytrue returns true if any element in a given collection is true or "true". It also returns false if the collection is empty.
base64decodebase64decode takes a string containing a Base64 character sequence and returns the original string.
base64encodebase64encode applies Base64 encoding to a string.
base64gzipbase64gzip compresses a string with gzip and then encodes the result in Base64 encoding.
base64sha256base64sha256 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.
base64sha512base64sha512 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.
basenamebasename takes a string containing a filesystem path and removes all except the last portion from it.
cancan evaluates the given expression and returns a boolean value indicating whether the expression produced a result without any errors.
ceilceil returns the closest whole number that is greater than or equal to the given value, which may be a fraction.
chompchomp removes newline characters at the end of a string.
chunklistchunklist splits a single list into fixed-size chunks, returning a list of lists.
cidrhostcidrhost calculates a full host IP address for a given host number within a given IP network address prefix.
cidrnetmaskcidrnetmask converts an IPv4 address prefix given in CIDR notation into a subnet mask address.
cidrsubnetcidrsubnet calculates a subnet address within given IP network address prefix.
cidrsubnetscidrsubnets calculates a sequence of consecutive IP address ranges within a particular CIDR prefix.
coalescecoalesce takes any number of arguments and returns the first one that isn’t null or an empty string.
coalescelistcoalescelist takes any number of list arguments and returns the first one that isn’t empty.
compactcompact takes a list of strings and returns a new list with any empty string elements removed.
concatconcat takes two or more lists and combines them into a single list.
containscontains determines whether a given list or set contains a given single value as one of its elements.
csvdecodecsvdecode decodes a string containing CSV-formatted data and produces a list of maps representing that data.
dirnamedirname takes a string containing a filesystem path and removes the last portion from it.
distinctdistinct takes a list and returns a new list with any duplicate elements removed.
elementelement retrieves a single element from a list.
endswithendswith takes two values: a string to check and a suffix string. The function returns true if the first string ends with that exact suffix.
filefile reads the contents of a file at the given path and returns them as a string.
filebase64filebase64 reads the contents of a file at the given path and returns them as a base64-encoded string.
filebase64sha256filebase64sha256 is a variant of base64sha256 that hashes the contents of a given file rather than a literal string.
filebase64sha512filebase64sha512 is a variant of base64sha512 that hashes the contents of a given file rather than a literal string.
fileexistsfileexists determines whether a file exists at a given path.
filemd5filemd5 is a variant of md5 that hashes the contents of a given file rather than a literal string.
filesetfileset 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.
filesha1filesha1 is a variant of sha1 that hashes the contents of a given file rather than a literal string.
filesha256filesha256 is a variant of sha256 that hashes the contents of a given file rather than a literal string.
filesha512filesha512 is a variant of sha512 that hashes the contents of a given file rather than a literal string.
flattenflatten takes a list and replaces any elements that are lists with a flattened sequence of the list contents.
floorfloor returns the closest whole number that is less than or equal to the given value, which may be a fraction.
formatThe 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.
formatdateformatdate converts a timestamp into a different time format.
formatlistformatlist produces a list of strings by formatting a number of other values according to a specification string.
indentindent adds a given number of spaces to the beginnings of all but the first line in a given multi-line string.
indexindex finds the element index for a given value in a list.
jsondecodejsondecode interprets a given string as JSON, returning a representation of the result of decoding that string.
jsonencodejsonencode encodes a given value to a string using JSON syntax.
keyskeys takes a map and returns a list containing the keys from that map.
lengthOflength determines the length of a given list, map, or string.
loglog returns the logarithm of a given number in a given base.
lowerlower converts all cased letters in the given string to lowercase.
matchkeysmatchkeys constructs a new list by taking a subset of elements from one list whose indexes match the corresponding indexes of values in another list.
maxmax takes one or more numbers and returns the greatest number from the set.
md5md5 computes the MD5 hash of a given string and encodes it with hexadecimal digits.
mergemerge 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.
minmin takes one or more numbers and returns the smallest number from the set.
nonsensitivenonsensitive takes a sensitive value and returns a copy of that value with the sensitive marking removed, thereby exposing the sensitive value.
oneone 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.
parseintparseint 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.
pathexpandpathexpand 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.
plantimestampplantimestamp returns a UTC timestamp string in RFC 3339 format, fixed to a constant time representing the time of the plan.
powpow calculates an exponent, by raising its first argument to the power of the second argument.
regexregex applies a regular expression to a string and returns the matching substrings.
regexallregexall applies a regular expression to a string and returns a list of all matches.
replacereplace searches a given string for another given substring, and replaces each occurrence with a given replacement string.
reversereverse 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.
rsadecryptrsadecrypt decrypts an RSA-encrypted ciphertext, returning the corresponding cleartext.
sensitivesensitive 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.
setintersectionThe 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 of the sets.
setproductThe setproduct function finds all of the possible combinations of elements from all of the given sets by computing the Cartesian product.
setsubtractThe 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 of the second set.
setunionThe 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 of the sets.
sha1sha1 computes the SHA1 hash of a given string and encodes it with hexadecimal digits.
sha256sha256 computes the SHA256 hash of a given string and encodes it with hexadecimal digits.
sha512sha512 computes the SHA512 hash of a given string and encodes it with hexadecimal digits.
signumsignum determines the sign of a number, returning a number between -1 and 1 to represent the sign.
sliceslice extracts some consecutive elements from within a list.
sortsort takes a list of strings and returns a new list with those strings sorted lexicographically.
splitsplit produces a list by dividing a given string at all occurrences of a given separator.
startswithstartswith takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix.
strcontainsstrcontains takes two values: a string to check and an expected substring. The function returns true if the string has the substring contained within it.
strrevstrrev reverses the characters in a string. Note that the characters are treated as Unicode characters (in technical terms, Unicode grapheme cluster boundaries are respected).
substrsubstr extracts a substring from a given string by offset and (maximum) length.
sumsum takes a list or set of numbers and returns the sum of those numbers.
templatefiletemplatefile reads the file at the given path and renders its content as a template using a supplied set of template variables.
textdecodebase64textdecodebase64 function decodes a string that was previously Base64-encoded, and then interprets the result as characters in a specified character encoding.
textencodebase64textencodebase64 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.
timeaddtimeadd adds a duration to a timestamp, returning a new timestamp.
timecmptimecmp compares two timestamps and returns a number that represents the ordering of the instants those timestamps represent.
timestamptimestamp returns a UTC timestamp string in RFC 3339 format.
titletitle converts the first letter of each word in the given string to uppercase.
tobooltobool converts its argument to a boolean value.
tolisttolist converts its argument to a list value.
tomaptomap converts its argument to a map value.
tonumbertonumber converts its argument to a number value.
tosettoset converts its argument to a set value.
tostringtostring converts its argument to a string value.
transposetranspose takes a map of lists of strings and swaps the keys and values to produce a new map of lists of strings.
trimtrim removes the specified set of characters from the start and end of the given string.
trimprefixtrimprefix 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.
trimspacetrimspace removes any space characters from the start and end of the given string.
trimsuffixtrimsuffix removes the specified suffix from the end of the given string.
trytry evaluates all of its argument expressions in turn and returns the result of the first one that does not produce any errors.
upperupper converts all cased letters in the given string to uppercase.
urlencodeurlencode applies URL encoding to a given string.
uuiduuid generates a unique identifier string.
uuidv5uuidv5 generates a name-based UUID, as described in RFC 4122 section 4.3, also known as a “version 5” UUID.
valuesvalues takes a map and returns a list containing the values of the elements in that map.
yamldecodeyamldecode parses a string as a subset of YAML, and produces a representation of its value.
yamlencodeyamlencode encodes a given value to a string using YAML 1.2 block syntax.
zipmapzipmap constructs a map from a list of keys and a corresponding list of values.
bcryptbcrypt computes a hash of the given string using the Blowfish cipher, returning a string in the Modular Crypt Format usually expected in the shadow password file on many Unix systems.
conditionalhttps://developer.hashicorp.com/terraform/language/expressions/conditionals A conditional expression uses the value of a boolean expression to select one of two values.
joinjoin produces a string by concatenating together all elements of a given list of strings with the given delimiter.
lookuplookup 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.
lookupNestedreturns a property access expression that accesses the property at the given path in the given inputMap.
rangerange generates a list of numbers using a start value, a limit value, and a step value.
rawStringUse this function to wrap a string and escape it properly for the use in Terraform This is only needed in certain scenarios (e.g., if you have unescaped double quotes in the string).

abs

import { Fn } from 'cdktn'

Fn.abs(num: number)
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.

numRequired

  • Type: number

abspath

import { Fn } from 'cdktn'

Fn.abspath(path: string)
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.

pathRequired

  • Type: string

alltrue

import { Fn } from 'cdktn'

Fn.alltrue(list: any[])
alltrue returns true if all elements in a given collection are true or "true". It also returns true if the collection is empty.

listRequired

  • Type: any[]

anytrue

import { Fn } from 'cdktn'

Fn.anytrue(list: any[])
anytrue returns true if any element in a given collection is true or "true". It also returns false if the collection is empty.

listRequired

  • Type: any[]

base64decode

import { Fn } from 'cdktn'

Fn.base64decode(str: string)
base64decode takes a string containing a Base64 character sequence and returns the original string.

strRequired

  • Type: string

base64encode

import { Fn } from 'cdktn'

Fn.base64encode(str: string)
base64encode applies Base64 encoding to a string.

strRequired

  • Type: string

base64gzip

import { Fn } from 'cdktn'

Fn.base64gzip(str: string)
base64gzip compresses a string with gzip and then encodes the result in Base64 encoding.

strRequired

  • Type: string

base64sha256

import { Fn } from 'cdktn'

Fn.base64sha256(str: string)
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.

strRequired

  • Type: string

base64sha512

import { Fn } from 'cdktn'

Fn.base64sha512(str: string)
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.

strRequired

  • Type: string

basename

import { Fn } from 'cdktn'

Fn.basename(path: string)
basename takes a string containing a filesystem path and removes all except the last portion from it.

pathRequired

  • Type: string

can

import { Fn } from 'cdktn'

Fn.can(expression: any)
can evaluates the given expression and returns a boolean value indicating whether the expression produced a result without any errors.

expressionRequired

  • Type: any

ceil

import { Fn } from 'cdktn'

Fn.ceil(num: number)
ceil returns the closest whole number that is greater than or equal to the given value, which may be a fraction.

numRequired

  • Type: number

chomp

import { Fn } from 'cdktn'

Fn.chomp(str: string)
chomp removes newline characters at the end of a string.

strRequired

  • Type: string

chunklist

import { Fn } from 'cdktn'

Fn.chunklist(list: any[], size: number)
chunklist splits a single list into fixed-size chunks, returning a list of lists.

listRequired

  • Type: any[]

sizeRequired

  • Type: number

cidrhost

import { Fn } from 'cdktn'

Fn.cidrhost(prefix: string, hostnum: number)
cidrhost calculates a full host IP address for a given host number within a given IP network address prefix.

prefixRequired

  • Type: string

hostnumRequired

  • Type: number

cidrnetmask

import { Fn } from 'cdktn'

Fn.cidrnetmask(prefix: string)
cidrnetmask converts an IPv4 address prefix given in CIDR notation into a subnet mask address.

prefixRequired

  • Type: string

cidrsubnet

import { Fn } from 'cdktn'

Fn.cidrsubnet(prefix: string, newbits: number, netnum: number)
cidrsubnet calculates a subnet address within given IP network address prefix.

prefixRequired

  • Type: string

newbitsRequired

  • Type: number

netnumRequired

  • Type: number

cidrsubnets

import { Fn } from 'cdktn'

Fn.cidrsubnets(prefix: string, newbits: number[])
cidrsubnets calculates a sequence of consecutive IP address ranges within a particular CIDR prefix.

prefixRequired

  • Type: string

newbitsRequired

  • Type: number[]

coalesce

import { Fn } from 'cdktn'

Fn.coalesce(vals: any[])
coalesce takes any number of arguments and returns the first one that isn’t null or an empty string.

valsRequired

  • Type: any[]

coalescelist

import { Fn } from 'cdktn'

Fn.coalescelist(vals: any[])
coalescelist takes any number of list arguments and returns the first one that isn’t empty.

valsRequired

  • Type: any[]

compact

import { Fn } from 'cdktn'

Fn.compact(list: string[])
compact takes a list of strings and returns a new list with any empty string elements removed.

listRequired

  • Type: string[]

concat

import { Fn } from 'cdktn'

Fn.concat(seqs: any[])
concat takes two or more lists and combines them into a single list.

seqsRequired

  • Type: any[]

contains

import { Fn } from 'cdktn'

Fn.contains(list: any, value: any)
contains determines whether a given list or set contains a given single value as one of its elements.

listRequired

  • Type: any

valueRequired

  • Type: any

csvdecode

import { Fn } from 'cdktn'

Fn.csvdecode(str: string)
csvdecode decodes a string containing CSV-formatted data and produces a list of maps representing that data.

strRequired

  • Type: string

dirname

import { Fn } from 'cdktn'

Fn.dirname(path: string)
dirname takes a string containing a filesystem path and removes the last portion from it.

pathRequired

  • Type: string

distinct

import { Fn } from 'cdktn'

Fn.distinct(list: any[])
distinct takes a list and returns a new list with any duplicate elements removed.

listRequired

  • Type: any[]

element

import { Fn } from 'cdktn'

Fn.element(list: any, index: number)
element retrieves a single element from a list.

listRequired

  • Type: any

indexRequired

  • Type: number

endswith

import { Fn } from 'cdktn'

Fn.endswith(str: string, suffix: string)
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.

strRequired

  • Type: string

suffixRequired

  • Type: string

file

import { Fn } from 'cdktn'

Fn.file(path: string)
file reads the contents of a file at the given path and returns them as a string.

pathRequired

  • Type: string

filebase64

import { Fn } from 'cdktn'

Fn.filebase64(path: string)
filebase64 reads the contents of a file at the given path and returns them as a base64-encoded string.

pathRequired

  • Type: string

filebase64sha256

import { Fn } from 'cdktn'

Fn.filebase64sha256(path: string)
filebase64sha256 is a variant of base64sha256 that hashes the contents of a given file rather than a literal string.

pathRequired

  • Type: string

filebase64sha512

import { Fn } from 'cdktn'

Fn.filebase64sha512(path: string)
filebase64sha512 is a variant of base64sha512 that hashes the contents of a given file rather than a literal string.

pathRequired

  • Type: string

fileexists

import { Fn } from 'cdktn'

Fn.fileexists(path: string)
fileexists determines whether a file exists at a given path.

pathRequired

  • Type: string

filemd5

import { Fn } from 'cdktn'

Fn.filemd5(path: string)
filemd5 is a variant of md5 that hashes the contents of a given file rather than a literal string.

pathRequired

  • Type: string

fileset

import { Fn } from 'cdktn'

Fn.fileset(path: string, pattern: string)
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.

pathRequired

  • Type: string

patternRequired

  • Type: string

filesha1

import { Fn } from 'cdktn'

Fn.filesha1(path: string)
filesha1 is a variant of sha1 that hashes the contents of a given file rather than a literal string.

pathRequired

  • Type: string

filesha256

import { Fn } from 'cdktn'

Fn.filesha256(path: string)
filesha256 is a variant of sha256 that hashes the contents of a given file rather than a literal string.

pathRequired

  • Type: string

filesha512

import { Fn } from 'cdktn'

Fn.filesha512(path: string)
filesha512 is a variant of sha512 that hashes the contents of a given file rather than a literal string.

pathRequired

  • Type: string

flatten

import { Fn } from 'cdktn'

Fn.flatten(list: any)
flatten takes a list and replaces any elements that are lists with a flattened sequence of the list contents.

listRequired

  • Type: any

floor

import { Fn } from 'cdktn'

Fn.floor(num: number)
floor returns the closest whole number that is less than or equal to the given value, which may be a fraction.

numRequired

  • Type: number

format

import { Fn } from 'cdktn'

Fn.format(format: string, args: any[])
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.

formatRequired

  • Type: string

argsRequired

  • Type: any[]

formatdate

import { Fn } from 'cdktn'

Fn.formatdate(format: string, time: string)
formatdate converts a timestamp into a different time format.

formatRequired

  • Type: string

timeRequired

  • Type: string

formatlist

import { Fn } from 'cdktn'

Fn.formatlist(format: string, args: any[])
formatlist produces a list of strings by formatting a number of other values according to a specification string.

formatRequired

  • Type: string

argsRequired

  • Type: any[]

indent

import { Fn } from 'cdktn'

Fn.indent(spaces: number, str: string)
indent adds a given number of spaces to the beginnings of all but the first line in a given multi-line string.

spacesRequired

  • Type: number

strRequired

  • Type: string

index

import { Fn } from 'cdktn'

Fn.index(list: any, value: any)
index finds the element index for a given value in a list.

listRequired

  • Type: any

valueRequired

  • Type: any

jsondecode

import { Fn } from 'cdktn'

Fn.jsondecode(str: string)
jsondecode interprets a given string as JSON, returning a representation of the result of decoding that string.

strRequired

  • Type: string

jsonencode

import { Fn } from 'cdktn'

Fn.jsonencode(val: any)
jsonencode encodes a given value to a string using JSON syntax.

valRequired

  • Type: any

keys

import { Fn } from 'cdktn'

Fn.keys(inputMap: any)
keys takes a map and returns a list containing the keys from that map.

inputMapRequired

  • Type: any

lengthOf

import { Fn } from 'cdktn'

Fn.lengthOf(value: any)
length determines the length of a given list, map, or string.

valueRequired

  • Type: any

log

import { Fn } from 'cdktn'

Fn.log(num: number, base: number)
log returns the logarithm of a given number in a given base.

numRequired

  • Type: number

baseRequired

  • Type: number

lower

import { Fn } from 'cdktn'

Fn.lower(str: string)
lower converts all cased letters in the given string to lowercase.

strRequired

  • Type: string

matchkeys

import { Fn } from 'cdktn'

Fn.matchkeys(values: any[], keys: any[], searchset: any[])
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.

valuesRequired

  • Type: any[]

keysRequired

  • Type: any[]

searchsetRequired

  • Type: any[]

max

import { Fn } from 'cdktn'

Fn.max(numbers: number[])
max takes one or more numbers and returns the greatest number from the set.

numbersRequired

  • Type: number[]

md5

import { Fn } from 'cdktn'

Fn.md5(str: string)
md5 computes the MD5 hash of a given string and encodes it with hexadecimal digits.

strRequired

  • Type: string

merge

import { Fn } from 'cdktn'

Fn.merge(maps: any[])
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.

mapsRequired

  • Type: any[]

min

import { Fn } from 'cdktn'

Fn.min(numbers: number[])
min takes one or more numbers and returns the smallest number from the set.

numbersRequired

  • Type: number[]

nonsensitive

import { Fn } from 'cdktn'

Fn.nonsensitive(value: any)
nonsensitive takes a sensitive value and returns a copy of that value with the sensitive marking removed, thereby exposing the sensitive value.

valueRequired

  • Type: any

one

import { Fn } from 'cdktn'

Fn.one(list: any)
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.

listRequired

  • Type: any

parseint

import { Fn } from 'cdktn'

Fn.parseint(number: any, base: number)
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.

numberRequired

  • Type: any

baseRequired

  • Type: number

pathexpand

import { Fn } from 'cdktn'

Fn.pathexpand(path: string)
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.

pathRequired

  • Type: string

plantimestamp

import { Fn } from 'cdktn'

Fn.plantimestamp()
plantimestamp returns a UTC timestamp string in RFC 3339 format, fixed to a constant time representing the time of the plan.

pow

import { Fn } from 'cdktn'

Fn.pow(num: number, power: number)
pow calculates an exponent, by raising its first argument to the power of the second argument.

numRequired

  • Type: number

powerRequired

  • Type: number

regex

import { Fn } from 'cdktn'

Fn.regex(pattern: string, str: string)
regex applies a regular expression to a string and returns the matching substrings.

patternRequired

  • Type: string

strRequired

  • Type: string

regexall

import { Fn } from 'cdktn'

Fn.regexall(pattern: string, str: string)
regexall applies a regular expression to a string and returns a list of all matches.

patternRequired

  • Type: string

strRequired

  • Type: string

replace

import { Fn } from 'cdktn'

Fn.replace(str: string, substr: string, replace: string)
replace searches a given string for another given substring, and replaces each occurrence with a given replacement string.

strRequired

  • Type: string

substrRequired

  • Type: string

replaceRequired

  • Type: string

reverse

import { Fn } from 'cdktn'

Fn.reverse(list: any)
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.

listRequired

  • Type: any

rsadecrypt

import { Fn } from 'cdktn'

Fn.rsadecrypt(ciphertext: string, privatekey: string)
rsadecrypt decrypts an RSA-encrypted ciphertext, returning the corresponding cleartext.

ciphertextRequired

  • Type: string

privatekeyRequired

  • Type: string

sensitive

import { Fn } from 'cdktn'

Fn.sensitive(value: any)
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.

valueRequired

  • Type: any

setintersection

import { Fn } from 'cdktn'

Fn.setintersection(first_set: any[], other_sets: any[][])
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 of the sets.

first_setRequired

  • Type: any[]

other_setsRequired

  • Type: any[][]

setproduct

import { Fn } from 'cdktn'

Fn.setproduct(sets: any[])
The setproduct function finds all of the possible combinations of elements from all of the given sets by computing the Cartesian product.

setsRequired

  • Type: any[]

setsubtract

import { Fn } from 'cdktn'

Fn.setsubtract(a: any[], b: any[])
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 of the second set.

aRequired

  • Type: any[]

bRequired

  • Type: any[]

setunion

import { Fn } from 'cdktn'

Fn.setunion(first_set: any[], other_sets: any[][])
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 of the sets.

first_setRequired

  • Type: any[]

other_setsRequired

  • Type: any[][]

sha1

import { Fn } from 'cdktn'

Fn.sha1(str: string)
sha1 computes the SHA1 hash of a given string and encodes it with hexadecimal digits.

strRequired

  • Type: string

sha256

import { Fn } from 'cdktn'

Fn.sha256(str: string)
sha256 computes the SHA256 hash of a given string and encodes it with hexadecimal digits.

strRequired

  • Type: string

sha512

import { Fn } from 'cdktn'

Fn.sha512(str: string)
sha512 computes the SHA512 hash of a given string and encodes it with hexadecimal digits.

strRequired

  • Type: string

signum

import { Fn } from 'cdktn'

Fn.signum(num: number)
signum determines the sign of a number, returning a number between -1 and 1 to represent the sign.

numRequired

  • Type: number

slice

import { Fn } from 'cdktn'

Fn.slice(list: any, start_index: number, end_index: number)
slice extracts some consecutive elements from within a list.

listRequired

  • Type: any

start_indexRequired

  • Type: number

end_indexRequired

  • Type: number

sort

import { Fn } from 'cdktn'

Fn.sort(list: string[])
sort takes a list of strings and returns a new list with those strings sorted lexicographically.

listRequired

  • Type: string[]

split

import { Fn } from 'cdktn'

Fn.split(separator: string, str: string)
split produces a list by dividing a given string at all occurrences of a given separator.

separatorRequired

  • Type: string

strRequired

  • Type: string

startswith

import { Fn } from 'cdktn'

Fn.startswith(str: string, prefix: string)
startswith takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix.

strRequired

  • Type: string

prefixRequired

  • Type: string

strcontains

import { Fn } from 'cdktn'

Fn.strcontains(str: string, substr: string)
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.

strRequired

  • Type: string

substrRequired

  • Type: string

strrev

import { Fn } from 'cdktn'

Fn.strrev(str: string)
strrev reverses the characters in a string. Note that the characters are treated as Unicode characters (in technical terms, Unicode grapheme cluster boundaries are respected).

strRequired

  • Type: string

substr

import { Fn } from 'cdktn'

Fn.substr(str: string, offset: number, length: number)
substr extracts a substring from a given string by offset and (maximum) length.

strRequired

  • Type: string

offsetRequired

  • Type: number

lengthRequired

  • Type: number

sum

import { Fn } from 'cdktn'

Fn.sum(list: any)
sum takes a list or set of numbers and returns the sum of those numbers.

listRequired

  • Type: any

templatefile

import { Fn } from 'cdktn'

Fn.templatefile(path: string, vars: any)
templatefile reads the file at the given path and renders its content as a template using a supplied set of template variables.

pathRequired

  • Type: string

varsRequired

  • Type: any

textdecodebase64

import { Fn } from 'cdktn'

Fn.textdecodebase64(source: string, encoding: string)
textdecodebase64 function decodes a string that was previously Base64-encoded, and then interprets the result as characters in a specified character encoding.

sourceRequired

  • Type: string

encodingRequired

  • Type: string

textencodebase64

import { Fn } from 'cdktn'

Fn.textencodebase64(str: string, encoding: string)
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.

strRequired

  • Type: string

encodingRequired

  • Type: string

timeadd

import { Fn } from 'cdktn'

Fn.timeadd(timestamp: string, duration: string)
timeadd adds a duration to a timestamp, returning a new timestamp.

timestampRequired

  • Type: string

durationRequired

  • Type: string

timecmp

import { Fn } from 'cdktn'

Fn.timecmp(timestamp_a: string, timestamp_b: string)
timecmp compares two timestamps and returns a number that represents the ordering of the instants those timestamps represent.

timestamp_aRequired

  • Type: string

timestamp_bRequired

  • Type: string

timestamp

import { Fn } from 'cdktn'

Fn.timestamp()
timestamp returns a UTC timestamp string in RFC 3339 format.

title

import { Fn } from 'cdktn'

Fn.title(str: string)
title converts the first letter of each word in the given string to uppercase.

strRequired

  • Type: string

tobool

import { Fn } from 'cdktn'

Fn.tobool(v: any)
tobool converts its argument to a boolean value.

vRequired

  • Type: any

tolist

import { Fn } from 'cdktn'

Fn.tolist(v: any)
tolist converts its argument to a list value.

vRequired

  • Type: any

tomap

import { Fn } from 'cdktn'

Fn.tomap(v: any)
tomap converts its argument to a map value.

vRequired

  • Type: any

tonumber

import { Fn } from 'cdktn'

Fn.tonumber(v: any)
tonumber converts its argument to a number value.

vRequired

  • Type: any

toset

import { Fn } from 'cdktn'

Fn.toset(v: any)
toset converts its argument to a set value.

vRequired

  • Type: any

tostring

import { Fn } from 'cdktn'

Fn.tostring(v: any)
tostring converts its argument to a string value.

vRequired

  • Type: any

transpose

import { Fn } from 'cdktn'

Fn.transpose(values: any)
transpose takes a map of lists of strings and swaps the keys and values to produce a new map of lists of strings.

valuesRequired

  • Type: any

trim

import { Fn } from 'cdktn'

Fn.trim(str: string, cutset: string)
trim removes the specified set of characters from the start and end of the given string.

strRequired

  • Type: string

cutsetRequired

  • Type: string

trimprefix

import { Fn } from 'cdktn'

Fn.trimprefix(str: string, prefix: string)
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.

strRequired

  • Type: string

prefixRequired

  • Type: string

trimspace

import { Fn } from 'cdktn'

Fn.trimspace(str: string)
trimspace removes any space characters from the start and end of the given string.

strRequired

  • Type: string

trimsuffix

import { Fn } from 'cdktn'

Fn.trimsuffix(str: string, suffix: string)
trimsuffix removes the specified suffix from the end of the given string.

strRequired

  • Type: string

suffixRequired

  • Type: string

try

import { Fn } from 'cdktn'

Fn.try(expressions: any[])
try evaluates all of its argument expressions in turn and returns the result of the first one that does not produce any errors.

expressionsRequired

  • Type: any[]

upper

import { Fn } from 'cdktn'

Fn.upper(str: string)
upper converts all cased letters in the given string to uppercase.

strRequired

  • Type: string

urlencode

import { Fn } from 'cdktn'

Fn.urlencode(str: string)
urlencode applies URL encoding to a given string.

strRequired

  • Type: string

uuid

import { Fn } from 'cdktn'

Fn.uuid()
uuid generates a unique identifier string.

uuidv5

import { Fn } from 'cdktn'

Fn.uuidv5(namespace: string, name: string)
uuidv5 generates a name-based UUID, as described in RFC 4122 section 4.3, also known as a “version 5” UUID.

namespaceRequired

  • Type: string

nameRequired

  • Type: string

values

import { Fn } from 'cdktn'

Fn.values(mapping: any)
values takes a map and returns a list containing the values of the elements in that map.

mappingRequired

  • Type: any

yamldecode

import { Fn } from 'cdktn'

Fn.yamldecode(src: string)
yamldecode parses a string as a subset of YAML, and produces a representation of its value.

srcRequired

  • Type: string

yamlencode

import { Fn } from 'cdktn'

Fn.yamlencode(value: any)
yamlencode encodes a given value to a string using YAML 1.2 block syntax.

valueRequired

  • Type: any

zipmap

import { Fn } from 'cdktn'

Fn.zipmap(keys: string[], values: any)
zipmap constructs a map from a list of keys and a corresponding list of values.

keysRequired

  • Type: string[]

valuesRequired

  • Type: any

bcrypt

import { Fn } from 'cdktn'

Fn.bcrypt(str: string, cost?: number)
bcrypt computes a hash of the given string using the Blowfish cipher, returning a string in the Modular Crypt Format usually expected in the shadow password file on many Unix systems.

strRequired

  • Type: string

costOptional

  • Type: number

conditional

import { Fn } from 'cdktn'

Fn.conditional(condition: any, trueValue: any, falseValue: any)
https://developer.hashicorp.com/terraform/language/expressions/conditionals A conditional expression uses the value of a boolean expression to select one of two values.

conditionRequired

  • Type: any

trueValueRequired

  • Type: any

falseValueRequired

  • Type: any

join

import { Fn } from 'cdktn'

Fn.join(separator: string, list: string[])
join produces a string by concatenating together all elements of a given list of strings with the given delimiter.

separatorRequired

  • Type: string

listRequired

  • Type: string[]

lookup

import { Fn } from 'cdktn'

Fn.lookup(inputMap: any, key: string, defaultValue?: any)
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.

inputMapRequired

  • Type: any

keyRequired

  • Type: string

defaultValueOptional

  • Type: any

lookupNested

import { Fn } from 'cdktn'

Fn.lookupNested(inputMap: any, path: any[])
returns a property access expression that accesses the property at the given path in the given inputMap. For example lookupNested(x, [“a”, “b”, “c”]) will return a Terraform expression like x[“a”][“b”][“c”]

inputMapRequired

  • Type: any

pathRequired

  • Type: any[]

range

import { Fn } from 'cdktn'

Fn.range(start: number, limit: number, step?: number)
range generates a list of numbers using a start value, a limit value, and a step value.

startRequired

  • Type: number

limitRequired

  • Type: number

stepOptional

  • Type: number

rawString

import { Fn } from 'cdktn'

Fn.rawString(str: string)
Use this function to wrap a string and escape it properly for the use in Terraform This is only needed in certain scenarios (e.g., if you have unescaped double quotes in the string).

strRequired

  • Type: string