2020-07-03 14:01:40 +02:00
|
|
|
---
|
2020-08-15 03:51:06 +02:00
|
|
|
layout: "language"
|
2020-10-21 19:56:56 +02:00
|
|
|
page_title: "textdecodebase64 - Functions - Configuration Language"
|
|
|
|
sidebar_current: "docs-funcs-encoding-textdecodebase64"
|
2020-07-03 14:01:40 +02:00
|
|
|
description: |-
|
2020-10-21 19:56:56 +02:00
|
|
|
The textdecodebase64 function decodes a string that was previously Base64-encoded,
|
2020-12-02 22:51:29 +01:00
|
|
|
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
|
|
|
|
as [`base64decode`](./base64decode.html).
|
|
|
|
|
|
|
|
## 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
|
|
|
|
|
2020-10-21 19:56:56 +02: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.
|
|
|
|
* [`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`.
|