How to Generate a Random Number/String in Terraform 2022-03-29 46 words - 1 min read 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