lookup retrieves the value of a single element from a map, given its key. If the given key does not exist, the given default value is returned instead.
variable "time" {
default = "month"
}
variable "days" {
default = {
"day" = "1"
"week" = "7"
"month" = "31"
}
}
output "lookup_value_output" {
value = lookup(var.days,var.time)
}
lookup return 31
join produces a string by concatenating together all elements of a given list of strings with the given delimiter.
join(separator, list)
join(", ", ["foo", "bar", "baz"])
https://www.terraform.io/docs/language/functions/join.html
split performs the opposite operation: producing a list by separating a single string using a given delimiter.
split(separator, string)
split(",", "foo,bar,baz")