mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-19 07:01:10 -05:00
These were initially introduced as functions with "encode" and "decode" prefixes, but that doesn't match with our existing convention of putting the encoding format first so that the encode and decode functions will group together in a alphabetically-ordered function list. "text" is not really a defined serialization format, but it's a short word that hopefully represents well enough what these functions are aiming to encode and decode, while being consistent with existing functions like jsonencode/jsondecode, yamlencode/yamldecode, etc. The "base64" at the end here is less convincing because there is precedent for that modifier to appear both at the beginning and the end in our existing function names. I chose to put it at the end here because that seems to be our emergent convention for situations where the base64 encoding is a sort of secondary modifier alongside the primary purpose of the function, as we see with "filebase64". (base64gzip is an exception here, but it seems outvoted by the others.)
1.5 KiB
1.5 KiB
layout: "functions"
page_title: "textdecodebase64 - Functions - Configuration Language"
sidebar_current: "docs-funcs-encoding-textdecodebase64"
description: |-
The textdecodebase64 function decodes a string that was previously Base64-encoded,
and then interprets the result as characters in a specified character encoding.
textdecodebase64 Function
-> Note: This function is supported only in Terraform v0.14 and later.
textdecodebase64 function decodes a string that was previously Base64-encoded,
and then interprets the result as characters in a specified character encoding.
Terraform uses the "standard" Base64 alphabet as defined in RFC 4648 section 4.
The encoding_name argument must contain one of the encoding names or aliases
recorded in
the IANA character encoding registry.
Terraform supports only a subset of the registered encodings, and the encoding
support may vary between Terraform versions.
Terraform accepts the encoding name UTF-8, which will produce the same result
as base64decode.
Examples
> textdecodebase64("SABlAGwAbABvACAAVwBvAHIAbABkAA==", "UTF-16LE")
Hello World
Related Functions
textencodebase64performs the opposite operation, applying target encoding and then Base64 to a string.base64decodeis effectively a shorthand fortextdecodebase64where the character encoding is fixed asUTF-8.