2020-07-03 14:01:40 +02:00
|
|
|
---
|
2021-11-23 00:57:25 +01:00
|
|
|
layout: "language"
|
|
|
|
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.
|
2020-07-03 14:01:40 +02:00
|
|
|
---
|
|
|
|
|
2020-10-21 19:56:56 +02:00
|
|
|
# `textdecodebase64` Function
|
2020-07-03 14:01:40 +02:00
|
|
|
|
|
|
|
-> **Note:** This function is supported only in Terraform v0.14 and later.
|
|
|
|
|
2020-10-21 19:56:56 +02:00
|
|
|
`textdecodebase64` function decodes a string that was previously Base64-encoded,
|
2020-07-03 14:01:40 +02:00
|
|
|
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](https://tools.ietf.org/html/rfc4648#section-4).
|
|
|
|
|
|
|
|
The `encoding_name` argument must contain one of the encoding names or aliases
|
|
|
|
recorded in
|
|
|
|
[the IANA character encoding registry](https://www.iana.org/assignments/character-sets/character-sets.xhtml).
|
|
|
|
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
|
2021-11-23 00:57:25 +01:00
|
|
|
as [`base64decode`](./base64decode.html).
|
2020-07-03 14:01:40 +02:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```
|
2020-10-21 19:56:56 +02:00
|
|
|
> textdecodebase64("SABlAGwAbABvACAAVwBvAHIAbABkAA==", "UTF-16LE")
|
2020-07-03 14:01:40 +02:00
|
|
|
Hello World
|
|
|
|
```
|
|
|
|
|
|
|
|
## Related Functions
|
|
|
|
|
2021-11-23 00:57:25 +01:00
|
|
|
* [`textencodebase64`](./textencodebase64.html) performs the opposite operation,
|
2020-07-03 14:01:40 +02:00
|
|
|
applying target encoding and then Base64 to a string.
|
2021-11-23 00:57:25 +01:00
|
|
|
* [`base64decode`](./base64decode.html) is effectively a shorthand for
|
2020-10-21 19:56:56 +02:00
|
|
|
`textdecodebase64` where the character encoding is fixed as `UTF-8`.
|