title: Terraform timestamp() to numbers only string
body: <p>The <a href="https://www.terraform.io/docs/configuration/interpolation.html#timestamp" rel="noreferrer"><code>timestamp()</code></a> function in the interpolation syntax will return an ISO 8601 formatted string, which looks like this <code>2019-02-06T23:22:28Z</code>. However, I want to have a string which looks like this <code>20190206232240706500000001</code>. A string with only numbers (integers) and no hyphens, white spaces, colon,  Z or T. What is a simple and elegant way to achieve this?</p>
  
  <p>It works if I replace every a single character class at the time hyphens, white spaces, colon Z and T:</p>
  
  <pre><code>locals {
    timestamp = "${timestamp()}"
    timestamp_no_hyphens = "${replace("${local.timestamp}", "-", "")}"
    timestamp_no_spaces = "${replace("${local.timestamp_no_hyphens}", " ", "")}"
    timestamp_no_t = "${replace("${local.timestamp_no_spaces}", "T", "")}"
    timestamp_no_z = "${replace("${local.timestamp_no_t}", "Z", "")}"
    timestamp_no_colons = "${replace("${local.timestamp_no_z}", ":", "")}"
    timestamp_sanitized = "${local.timestamp_no_colons}"
  }
  
  output "timestamp" {
    value = "${local.timestamp_sanitized}"
  }
  </code></pre>
  
  <p>The resulting output is in the desired format, except the string is significantly shorter:</p>
  
  <pre><code>Outputs:
  
  timestamp = 20190207000744
  </code></pre>
  
  <p>However, this solution is very ugly. Is there another way of doing the same thing in a more elegant way as well as producing a string with the same length as the example string <code>20190206232240706500000001</code>?</p>