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

     1  ---
     2  layout: "functions"
     3  page_title: "base64gzip - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-encoding-base64gzip"
     5  description: |-
     6    The base64encode function compresses the given string with gzip and then
     7    encodes the result in Base64.
     8  ---
     9  
    10  # `base64gzip` Function
    11  
    12  -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and
    13  earlier, see
    14  [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html).
    15  
    16  `base64gzip` compresses a string with gzip and then encodes the result in
    17  Base64 encoding.
    18  
    19  Terraform uses the "standard" Base64 alphabet as defined in
    20  [RFC 4648 section 4](https://tools.ietf.org/html/rfc4648#section-4).
    21  
    22  Strings in the Terraform language are sequences of unicode characters rather
    23  than bytes, so this function will first encode the characters from the string
    24  as UTF-8, then apply gzip compression, and then finally apply Base64 encoding.
    25  
    26  While we do not recommend manipulating large, raw binary data in the Terraform
    27  language, this function can be used to compress reasonably sized text strings
    28  generated within the Terraform language. For example, the result of this
    29  function can be used to create a compressed object in Amazon S3 as part of
    30  an S3 website.
    31  
    32  ## Related Functions
    33  
    34  * [`base64encode`](./base64encode.html) applies Base64 encoding _without_
    35    gzip compression.
    36  * [`filebase64`](./filebase64.html) reads a file from the local filesystem
    37    and returns its raw bytes with Base64 encoding.