github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/urlencode.mdx (about) 1 --- 2 page_title: urlencode - Functions - Configuration Language 3 description: The urlencode function applies URL encoding to a given string. 4 --- 5 6 # `urlencode` Function 7 8 `urlencode` applies URL encoding to a given string. 9 10 This function identifies characters in the given string that would have a 11 special meaning when included as a query string argument in a URL and 12 escapes them using 13 [RFC 3986 "percent encoding"](https://tools.ietf.org/html/rfc3986#section-2.1). 14 15 The exact set of characters escaped may change over time, but the result 16 is guaranteed to be interpolatable into a query string argument without 17 inadvertently introducing additional delimiters. 18 19 If the given string contains non-ASCII characters, these are first encoded as 20 UTF-8 and then percent encoding is applied separately to each UTF-8 byte. 21 22 ## Examples 23 24 ``` 25 > urlencode("Hello World") 26 Hello%20World 27 > urlencode("☃") 28 %E2%98%83 29 > "http://example.com/search?q=${urlencode("terraform urlencode")}" 30 http://example.com/search?q=terraform+urlencode 31 ```