github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/base64decode.html.md (about) 1 --- 2 layout: "language" 3 page_title: "base64decode - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-encoding-base64decode" 5 description: |- 6 The base64decode function decodes a string containing a base64 sequence. 7 --- 8 9 # `base64decode` Function 10 11 `base64decode` takes a string containing a Base64 character sequence and 12 returns the original string. 13 14 Terraform uses the "standard" Base64 alphabet as defined in 15 [RFC 4648 section 4](https://tools.ietf.org/html/rfc4648#section-4). 16 17 Strings in the Terraform language are sequences of unicode characters rather 18 than bytes, so this function will also interpret the resulting bytes as 19 UTF-8. If the bytes after Base64 decoding are _not_ valid UTF-8, this function 20 produces an error. 21 22 While we do not recommend manipulating large, raw binary data in the Terraform 23 language, Base64 encoding is the standard way to represent arbitrary byte 24 sequences, and so resource types that accept or return binary data will use 25 Base64 themselves, which avoids the need to encode or decode it directly in 26 most cases. Various other functions with names containing "base64" can generate 27 or manipulate Base64 data directly. 28 29 `base64decode` is, in effect, a shorthand for calling 30 [`textdecodebase64`](./textdecodebase64.html) with the encoding name set to 31 `UTF-8`. 32 33 ## Examples 34 35 ``` 36 > base64decode("SGVsbG8gV29ybGQ=") 37 Hello World 38 ``` 39 40 ## Related Functions 41 42 * [`base64encode`](./base64encode.html) performs the opposite operation, 43 encoding the UTF-8 bytes for a string as Base64. 44 * [`textdecodebase64`](./textdecodebase64.html) is a more general function that 45 supports character encodings other than UTF-8. 46 * [`base64gzip`](./base64gzip.html) applies gzip compression to a string 47 and returns the result with Base64 encoding. 48 * [`filebase64`](./filebase64.html) reads a file from the local filesystem 49 and returns its raw bytes with Base64 encoding.