github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/base64decode.html.md (about)

     1  ---
     2  layout: "functions"
     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  -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and
    12  earlier, see
    13  [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html).
    14  
    15  `base64decode` takes a string containing a Base64 character sequence and
    16  returns the original string.
    17  
    18  Terraform uses the "standard" Base64 alphabet as defined in
    19  [RFC 4648 section 4](https://tools.ietf.org/html/rfc4648#section-4).
    20  
    21  Strings in the Terraform language are sequences of unicode characters rather
    22  than bytes, so this function will also interpret the resulting bytes as
    23  UTF-8. If the bytes after Base64 decoding are _not_ valid UTF-8, this function
    24  produces an error.
    25  
    26  While we do not recommend manipulating large, raw binary data in the Terraform
    27  language, Base64 encoding is the standard way to represent arbitrary byte
    28  sequences, and so resource types that accept or return binary data will use
    29  Base64 themselves, which avoids the need to encode or decode it directly in
    30  most cases. Various other functions with names containing "base64" can generate
    31  or manipulate Base64 data directly.
    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  * [`base64gzip`](./base64gzip.html) applies gzip compression to a string
    45    and returns the result with Base64 encoding.
    46  * [`filebase64`](./filebase64.html) reads a file from the local filesystem
    47    and returns its raw bytes with Base64 encoding.