Terraform: Fun with Random Resources

Yes! You can actually have some fun with Terraform!
I saw this in Kristin Laemmert’s video A Tour of Terraform 0.12 (transcript). She used the random_pet resource to generate random pet names.

The code is very simple and fun to play with. Here is my own version of her example:

The result looks something like this:

There are a number of options to play with. For example if you set zoo_enabled to true. The prefix_list will be used:

There are various other random resources provided. They can generate IDs, integers, passwords, strings, and UUIDs.

Another fun random resource is shuffle. It shuffles a given list of items:

Read more about these resources in the official Terraform documentation.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.