any - Default value if no type is specified.
any - is not itself a type. It is a special construct that serves as a placeholder for a type yet to be decided.
Terraform will attempt to find a single actual type that could replace the any keyword to produce a valid result.
Example:
variable "no_type" {
type = any
}
number:
variable "length" {
default = 1
type = number
description = "Length of generated name"
}
bool:
variable "password_change" {
default = "true"
type = bool
description = "Change the password"
}
string:
variable "sfilename" {
default = "/tmp/file.txt"
type = string
description = "Path of the local file"
}
listvariable "prefix" {
default = ["Mr", "Mrs", "Sir"]
type = list(string)
description = "List of prefixes for cats name"
}
mapvariable "file_content" {
default = {
"dogs" = "We love dogs!"
"cats" = "We love cats!"
}
type = map(string)
description = "Cats or dogs"
}
setvariable "valid_ages" {
default = [15, 20, 25]
type = set(number)
description = "Valid ages for celebration"
}
objectvariable "tom" {
type = object({
name = string
color = string
age = number
food = list(string)
favorite_pet = bool
})
default = {
name = "Tom"
color = "brown"
age = 7
food = ["fish", "chicken", "turkey"]
favorite_pet = true
})
description = "Tom the cat"
}
tuplevariable "kitty" {
type = tuple([string, number, bool])
default = ["cat", 7, true]
description = "Cats details"
}