How to encode an URL in terraform?

You can use terraform urlencode() function to encode an URL in terraform. urlencode() identifies characters in the given string that would have a special meaning when included as a query string argument in a URL and escapes them

Syntax: urlencode(url)

Example: