You're looking at documentation for Terraform v1.1 and earlier. Click here to view the latest content.
A new platform for documentation and tutorials is launching soon.
We are migrating Terraform documentation into HashiCorp Developer, our new developer experience.
Note: This function is supported only in Terraform v0.14 and later.
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.
Terraform uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
encoding_name argument must contain one of the encoding names or aliases
the IANA character encoding registry.
Terraform supports only a subset of the registered encodings, and the encoding
support may vary between Terraform versions. In particular Terraform supports
UTF-16LE, which is the native character encoding for the Windows API and
therefore sometimes expected by Windows-originated software such as PowerShell.
Terraform also accepts the encoding name
UTF-8, which will produce the same
> textencodebase64("Hello World", "UTF-16LE") SABlAGwAbABvACAAVwBvAHIAbABkAA==
textdecodebase64performs the opposite operation, decoding Base64 data and interpreting it as a particular character encoding.
base64encodeapplies Base64 encoding of the UTF-8 encoding of a string.
filebase64reads a file from the local filesystem and returns its raw bytes with Base64 encoding, without creating an intermediate Unicode string.