Let's have the following main.tf:
resource "random_pet" "my-cat" {
prefix = "Mrs"
separator = "."
length = 1
}
So, it can be transformed in a sequence of following files by using variables.variable "separator" {
default = "."
type = string
description = "The cat name separator"
}
variable "length" {
default = 1
type = number
description = "Length of generated name"
}
variable "prefix" {
default = ["Mr", "Mrs", "Sir"]
type = list
description = "List of prefixes for cats name"
}
main.tf:
resource "random_pet" "my-cat" {
prefix = var.prefix[0]
separator = var.separator
length = var.length
}
Run plan and apply ro see the results.