How to get the current time and date using terraform timestamp() function?

You can use terraform timestamp() function to get the current time and date. timestamp() returns a UTC timestamp string in RFC 3339 format which can further be formatted using formatdate() function.

Syntax: timestamp()

Examples: