If you need to generate a random number or string in Terraform, then you can use the following:

1
2
3
4
5
6
resource "random_id" "myrandom" {
  keepers = {
    first = "${timestamp()}"
  }     
  byte_length = 8
}

Then refer to it as:

1
random_id.myrandom.hex